Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
怎么还是会wa?都注意到了啊……#include "stdio.h" #include "math.h" main() { int i, counter, t; long int a, b; while (scanf ("%ld %ld", &a, &b)&&(a||b)) { t=0; counter=0; for (i=0; i<10; i++) { if (a/(int)(pow(10,i))%10+b/(int)(pow(10,i))%10+t>9) { counter++; t=1; } else { t=0; } } if (counter) { if (counter>1) { printf ("%d carry operations.\n", counter); } else { printf ("1 carry operation.\n"); } } else { printf ("No carry operation.\n"); } } } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator