#include <set>
#include <map>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
long long n, lim, x1, x2;
int tst;
cin >> tst;
while (tst--)
{
cin >> n;
lim = (int)(ceil(sqrt(double(n*2))));
x1 = lim * (lim+1) / 2;
x2 = (lim-1)*lim/2;
if (x1 <= n)
{
cout << lim << endl;
} else if (x2<=n)
{
cout << lim-1 << endl;
} else
{
cout << lim-2 << endl;
}
}
return 0;
}
Tuesday, November 22, 2011
[UVa] 11614 - Etruscan Warriors Never Play Chess
Subscribe to:
Post Comments (Atom)
Connect Rapoo MT750S with Linux (Tested on Manjaro)
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
I like coding a lot, keeps me glued to the PC for hours. For that reason it's a need to edit the Syntax Highlighter to suit my eyes for...
-
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
Method: The problem at first glance seems too straightforward but it's not that much. Think a bit about the lines "Erin can add ...
No comments:
Post a Comment
Post your comment here. If you want to say something about programming problems, scripts, software etc, please try to be as descriptive as possible.