/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Wrong Answer 1ms 536.0 KiB
#3 Wrong Answer 1ms 532.0 KiB

Code

#pragma GCC optimize("Ofast")
#include <iostream>
#include <math.h>
#include <cstdint>
using namespace std;
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x << " = " << x << endl
#else
#define debug(x)
#endif

using ll = long long;
/*
a(a-1) = n
=> a^2 - a - n = 0
x1 = (-1 + sqrt(b*b - 4 *a*c))/2*a
*/
void Solve()
{
    ll n;
    cin >> n;
    cout << floor(sqrt(n)) + (floor(sqrt(1 + n*4)) - 1)/2 << endl;
}

int32_t main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    ll t = 1;
    // cin >> t;
    while (t--)
        Solve();
    return 0;
}

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:40:00
Judged At
2025-06-13 16:40:00
Judged By
Score
0
Total Time
1ms
Peak Memory
536.0 KiB