Accepted
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