UVA - 10025 The ? 1 ? 2 ? ... ? n = k problem
2014-09-21 13:24
399 查看
#include<cstdio> #include<cmath> int main() { long long test; long long number; long long count; int mark; scanf("%lld\n\n", &test); while(test--) { scanf("%lld\n\n", &number); number = fabs(number); for(count = 1; ; count++) if((count * count + count ) / 2 >= number) break; while(((count * count + count) / 2 - number) % 2 != 0) count++; /* if(temp == 1 && count % 2 == 0 && i != test - 1) { printf("%d\n\n", count + 1); continue; } if(temp == 1 && count % 2 == 0 && i == test - 1) { printf("%d\n", count + 1); continue; } if(temp % 2 == 0) mark = 1; else mark = 0; if(mark == 1 && i != test - 1) printf("%lld\n\n", count); if(mark == 0 && i != test - 1) printf("%lld\n\n", count + 2); if(mark == 1 && i == test - 1) printf("%lld\n", count); if(mark == 0 && i == test - 1) printf("%lld\n", count + 2); */ if(number== 0) printf("3\n"); else printf("%d\n", count); if(test) printf("\n"); } return 0; }
相关文章推荐
- uva_10025 - The ? 1 ? 2 ? ... ? n = k problem
- UVA 10025 The ? 1 ? 2 ? ... ? n = k problem
- UVA - 10025 :The ? 1 ? 2 ? ... ? n = k problem
- Uva 10025 - The ? 1 ? 2 ? ... ? n = k problem
- UVA-10025 The ? 1 ? 2 ? ... ? n = k problem
- 【Math】UVa 10025 – The ? 1 ? 2 ? … ? n = k problem
- UVa 10025 - The ? 1 ? 2 ? ... ? n = k problem
- Uva 10025 The ? 1 ? 2 ? ... ? n = k problem
- UVA - 10025 The ? 1 ? 2 ? ... ? n = k problem
- UVA - 10025 The ? 1 ? 2 ? ... ? n = k problem
- UVa 10025 - The ? 1 ? 2 ? ... ? n = k problem
- UVa 10025: The ? 1 ? 2 ? ... ? n = k problem
- uva 10025 - The ? 1 ? 2 ? ... ? n = k problem
- UVA 10025 The ? 1 ? 2 ? ... ? n = k problem
- UVA 10025 - The ? 1 ? 2 ? ... ? n = k problem
- UVA - 10025 The ? 1 ? 2 ? ... ? n = k problem
- UVa 10025 The ? 1 ? 2 ? ... ? n = k problem
- UVA - 10025 The ? 1 ? 2 ? ... ? n = k problem
- uva 10025 The ? 1 ? 2 ? ... ? n = k problem 给公式填加减号
- UVa 10025 - The ? 1 ? 2 ? ... ? n = k problem