/ SeriousOJ /

Record Detail

Accepted


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

Code

//Don't Panic
//Read the q properly
//Don't see the standings until the contest is over.
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define yes cout<<"YES"<<endl
#define no cout<<"NO"<<endl
#define vsum(v)  accumulate(v.begin(),v.end(),0LL)
#define maxi(v)  *max_element(v.begin(),v.end())
#define mini(v)  *min_element(v.begin(),v.end())
#define sort(v) sort(v.begin(),v.end())
const int N=1e7+10;
// vector<bool> isPrime(N,1);
// vector<int> hp(N,0),lp(N,0);
//a+b=(a ^b)+2.(a&b)
//function to check whether a given number is prime or not
bool checkPrime(int n) {
    if (n<=1) return false;
    if (n<=3) return true;
    if (n%2==0 || n%3==0) return false;
    for(int i=5; i*i<=n;i+=6) {
        if(n%i==0 || n%(i+2)==0)
            return false;
    }
    return true;
}
//sieve
// void sieve(){
//     isPrime[0]=isPrime[1]=false;
//     for(int i=2;i<N;i++){
//         if(isPrime[i]==true){
//             lp[i]=hp[i]=i;
//             for(int j=2*i;j<N;j+=i){
//                 isPrime[j]=false;
//                 hp[j]=i;
//                 if(lp[j]==0){
//                     lp[j]=i;
//                 }
//             }
//         }
//     }
// }
void solve(){
    //code yaha par likh
    int n;
    cin>>n;
    int i=0;
    int add=1;
    int t=0;
    int cnt=0;
    while(i<=n){
        if(t==2){
            add++;
            t=0;
        }
        else{
            i+=add;
            t++;
            if(i<=n) cnt++;
            else break;
        }
    }
    cout<<cnt<<endl;
    
}
signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t=1;
    // int t;cin>>t;
    while(t--){
        solve();
    }
}

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