# |
Author |
Problem |
Lang |
Verdict |
Time |
Memory |
Sent |
Judged |
|
220217511 |
Contestant:
qbning |
1862D
- 28
|
C++17 (GCC 7-32)
|
Accepted
|
62 ms
|
8 KB
|
2023-08-24 18:20:53 |
2023-08-27 03:08:23 |
|
// Problem: D. Ice Cream Balls
// Contest: Codeforces - Codeforces Round 894 (Div. 3)
// URL: https://mirror.codeforces.com/contest/1862/problem/D
// Memory Limit: 256 MB
// Time Limit: 1000 ms
#pragma GCC optimize(2)
#include<iostream>
#include<cmath>
using namespace std;
typedef long long ll;
ll a;
void solve()
{
cin>>a;
ll ans=(1+sqrt(1+8*a))/2;
a-=(ans*(ans-1)/2);
ans+=a;
cout<<ans<<'\n';
}
int main()
{
int t;
cin>>t;
while(t--)solve();
return 0;
}
Click to see test details