/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 532.0 KiB
#2 Accepted 2ms 532.0 KiB
#3 Accepted 2ms 532.0 KiB
#4 Accepted 2ms 532.0 KiB
#5 Accepted 2ms 532.0 KiB
#6 Accepted 2ms 532.0 KiB

Code

#include <bits/stdc++.h>

#define int long long
#define ull unsigned long long
#define pf push_front
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define vi vector<int>
#define endl "\n"
using namespace std;

void solve(int tt) {
    int n;
    cin >> n;

    int ans = 0;
    for (int i = 1; i * i <= n; i++) {
        if (i * i <= n)
            ans++;
        if (i * (i + 1) <= n)
            ans++;
    }

    cout << ans << endl;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

#ifdef ONPC
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif

    int testcase = 1;
    // cin >> testcase;

    for (int tt = 1; tt <= testcase; tt++) {
        solve(tt);
    }

    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 15:35:10
Judged At
2025-06-13 15:35:10
Judged By
Score
100
Total Time
2ms
Peak Memory
532.0 KiB