/ SeriousOJ /

Record Detail

Accepted


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

Code

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

#define int        long long int
#define pb         push_back
#define all(x)     x.begin(),x.end()
#define allr(x)    x.rbegin(),x.rend()
#define ii         pair<int,int>
#define endl       '\n'

void pipra() {
    int n;
    cin >> n;
    int sq = sqrt(n);
    cout << (sq - 1) * 2 + 1 + ((sq * (sq + 1)) <= n) << endl;
}

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

    int t = 1;
    // cin >> t;
    for(int i = 1 ; i <= t ; i++) {
        // cout << "Case " << i << ": ";
        pipra();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1191 A. Balanced Product
Language
C++17 (G++ 13.2.0)
Submit At
2025-06-15 15:49:55
Judged At
2025-06-15 15:49:55
Judged By
Score
100
Total Time
1ms
Peak Memory
540.0 KiB