标签:
Baby Ming and Weight lifting
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1365 Accepted Submission(s): 500
#include <stdio.h> int main() { int i, j, t, a, b, c, flag; scanf("%d", &t); while(t--) { scanf("%d%d%d", &a, &b, &c); if(c&1) { printf("Impossible\n"); continue; } for(c /= 2,flag=0,i=0;!flag&&i<=2000;i++)//a+b的个数 for(j=0;!flag&&j<=i;j++)//b的个数 if((i-j)*a+j*b==c&&(flag=1)) printf("%d %d\n", (i-j)<<1, j<<1); if(!flag) printf("Impossible\n"); } return 0; }
HDU 5610 Baby Ming and Weight lifting
标签:
原文地址:http://www.cnblogs.com/Noevon/p/5410780.html