Problem Name: Etruscan Warriors Never Play Chess
Author’s Name: Ginés GarcÃa Mateos, UM Espanha
Timelimit: 1
Problem Category: AD-HOC
Problem Source: https://www.urionlinejudge.com.br/judge/en/problems/view/1308
Solution:
#include <stdio.h>#include <math.h>
int main(){
int n,i;
long long int m;
double delta, y;
scanf("%d", &n);
for(i = 0; i < n; i++){
scanf("%lld", &m);
delta = 1 + 8*m;
y = (-1 + sqrt(delta))/2;
printf("%lldn", (long long int)y);
}
return 0;
}
No comments:
Post a Comment
Thanks..