Saturday, October 22, 2016

UVA 11614 - Etruscan Warriors Never Play Chess

#include<bits/stdc++.h>
#define printCase cout << "Case "<< ++kase<<":"
#define sf scanf
#define pf printf
#define FAST ios_base::sync_with_stdio(false)
using namespace std;

int main()
{
//FAST;
double T , kase = 0;
    sf("%lf",&T);
    while(T--){
        double n;
        sf("%lf",&n);
        pf("%lld\n",(long long)(sqrt(1+8*n)-1)/2);

    }
return 0;
}

No comments:

Post a Comment