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 |
请指点……怎wrong answer?#include <stdio.h> int max(int n, int m) { int i, j, c = 0, add; for (j = n; j <= m; j++){ add = 0; for (i = j; i >= 1;){ if (i == 1){ add++; break; } else if(i % 2 == 0){ i = i/2; add++; } else {i = 3 * i + 1; add++; } } if (c < add) c = add; } return c; } int main() { int x, y, Max; while (scanf ("%d%d", &x, &y) == 2){ Max = max(x, y); printf ("%d %d %d", x, y, Max); printf ("\n"); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator