/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 1ms 532.0 KiB
#3 Accepted 2ms 484.0 KiB
#4 Accepted 1ms 484.0 KiB
#5 Accepted 3ms 832.0 KiB
#6 Accepted 17ms 3.395 MiB

Code

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define no cout << "NO" << "\n";
#define yes cout << "YES" << "\n";

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n;
    cin >> n;

    set<ll> s; // To store unique values

    for (ll i = 1; i * i <= n; i++)
    {
        ll sq = i * i;
        if (sq <= n)
            s.insert(sq);

        ll semi = i * (i + 1);
        if (semi <= n)
            s.insert(semi);
    }

    cout << s.size() << "\n";

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1191 A. Balanced Product
Contest
Brain Booster #10
Language
C++17 (G++ 13.2.0)
Submit At
2025-06-13 16:05:10
Judged At
2025-06-13 16:05:10
Judged By
Score
100
Total Time
17ms
Peak Memory
3.395 MiB