/ SeriousOJ /

Record Detail

Accepted


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

Code

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define pb             push_back
#define all(x)         (x).begin(), (x).end()
#define debug(x)       { cerr << #x << " = " << x << endl; }
#define IO             { ios_base::sync_with_stdio(false); cin.tie(0); }
#define read(x)        freopen(x, "r", stdin)
#define write(x)       freopen(x, "w", stdout)
#define endl           '\n'
#define int            long long
using namespace std;

typedef long long      ll;
typedef pair<int, int> ii;
typedef vector<int>    vi;

void solve() {
    int n;
    cin >> n;
    int x = 1, ans = 0;
    while(true) {
        int k = x*x;
        if(x*x > n) break;
        ans++;
        if(x*(x+1) <= n) ans++;
        x++;
    }
    cout << ans << endl;
}

signed main() {
    IO;
    int tc = 1;

    // #ifndef ONLINE_JUDGE
    // read("input.txt");
    // write("output.txt");
    // #endif

    // cin >> tc;
    for (int cs = 1; cs <= tc; cs++) {
        solve();
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1191 A. Balanced Product
Language
C++17 (G++ 13.2.0)
Submit At
2025-07-11 17:58:09
Judged At
2025-07-11 17:58:09
Judged By
Score
100
Total Time
4ms
Peak Memory
536.0 KiB