Advertisement
juanjo12x

UVA_11614_Etruscan_Warriors

Aug 9th, 2014
265
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <algorithm>
  4. #include <cstring>
  5. #include <string>
  6. #include <cctype>
  7. #include <stack>
  8. #include <queue>
  9. #include <list>
  10. #include <vector>
  11. #include <map>
  12. #include <set>
  13. #include <sstream>
  14. #include <stdlib.h>
  15. #include <cmath>
  16. #define LL unsigned long long
  17. using namespace std;
  18.  
  19. int main() {
  20.     int t;
  21.     double n;
  22.     double n1;
  23.     scanf("%d",&t);
  24.     while(t--){
  25.         scanf("%lf",&n);
  26.         n1=-1+(sqrt(1+(8*n)));
  27.         n1=n1/2;
  28.         int k = (int) n1;
  29.         printf("%d\n",k);
  30.     }
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement