/ SeriousOJ /

Record Detail

Accepted


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

Code

#include<bits/stdc++.h>
using namespace std;

#define int long long
#define yes cout<<"YES"<<'\n'
#define no cout<<"NO"<<'\n'
#define nl cout<<"\n"

void solve() {
    int n; cin>>n;
    int ans = 0;
    for(int i=1; i<=n; i++)
    {
        if(i*(i+1) <= n){
            ans++;  
            if(i*i <= n) ans++;
        }
        else if(i*i <= n){
            ans++;  
            if(i*(i+1) <= n) ans++;
        }
        else{
            break;
        }
    }
    cout<<ans;
}

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

    int t=1;
    // cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


/*



1 = 1
2 = 2
3 = 2
4 = 3
5 = 3
6 = 4
7 = 4
8 = 4
9 = 5
10 = 5
11 = 5
12 = 6
13 = 5
14 = 5
15 = 5
16 = 6








*/

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:14:04
Judged At
2025-06-13 16:14:04
Judged By
Score
100
Total Time
1ms
Peak Memory
532.0 KiB