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 |
Please give me some sample tests. Thanks!# include <stdio.h> # include <string.h> char digits[32800]; main () { int i; int base = 0, value = 0, flag = 0; while (scanf ("%s", digits) != -1) { for (i = 0; i < strlen (digits); i++) { if (digits[i] > base) base = digits[i]; if (base >= '0' && base <= '9') value += digits[i] - '0'; else if (base >= 'A' && base <= 'Z') value += digits[i] - 'A' + 10; else value += digits[i] - 'a' + 36; } if (base >= '0' && base <= '9') base = base - '0' + 1; else if (base >= 'A' && base <= 'Z') base = base - 'A' + 11; else base = base - 'a' + 37; while (base <= 62) { if (value % (base - 1) == 0) { flag = 1; break; } base++; } if (flag == 1) { printf ("%d\n", base); flag = 0; } else printf ("such number is impossible!\n"); base = 2; value = 0; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator