真是日了狗了
时间:2015-04-18 19:04:06
收藏:0
阅读:104
HDU 4143 A Simple Problem
因为x要最小,从最小的j-i开始枚举

1 #include <cstdio> 2 #include <cmath> 3 4 int main() { 5 int t, n, j; 6 scanf("%d", &t); 7 while (t--) { 8 int ans = -1; 9 scanf("%d", &n); 10 for (int i = sqrt(n); i >= 1; i--) { 11 if (n % i == 0 && n != i*i) { 12 j = n / i; 13 if ((j-i)%2==0) { 14 ans = (j-i)/2; 15 break; 16 } 17 } 18 } 19 printf("%d\n", ans); 20 } 21 return 0; 22 }
HDU 4144 Bacon‘s Cipher
HDU 4145Cover The Enemy
评论(0)