/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Wrong Answer 1ms 532.0 KiB
#2 Accepted 1ms 468.0 KiB
#3 Accepted 1ms 536.0 KiB
#4 Accepted 1ms 532.0 KiB
#5 Accepted 1ms 532.0 KiB
#6 Wrong Answer 1ms 532.0 KiB

Code

#define ll long long
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
std::string toBinaryString(long long num) {
std::bitset<64> binary(num);
return binary.to_string();
}
long long binaryToLongLong(const std::string& binary) {
std::bitset<64> binarySet(binary);
return static_cast<long long>(binarySet.to_ullong());
}
bool compareByFirst(const std::pair<ll, ll>& a, const std::pair<ll, ll>& b) {
return a.first < b.first; // Ascending order by the first element
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
    long long t;
    t=1;
    while(t--){
        long long n;
        cin>>n;
        ll x=sqrt(n);
        ll z=x*(x+1);
        ll ans=1;
        if(n==1)
        cout<<1<<endl;
        else if(n==2)
        {
            cout<<2<<endl;
        }
        else if(n==3)
        cout<<2<<endl;
        else if(n==4)
        {
            cout<<3<<endl;
        }
        else if(n==5)
        cout<<3<<endl;
        else if(z==n){
            ans++;
            ans+=(x-1)*2;
            cout<<ans<<endl;
        }
        else 
        {
            ans+=(x-1)*2;
            
            cout<<ans<<endl;
        }
    }
}

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:57:13
Judged At
2025-06-13 15:57:13
Judged By
Score
80
Total Time
1ms
Peak Memory
536.0 KiB