| ||||||||||
| 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 | |||||||||
这种题有现成的库函数可用的……#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char a[9], b[9], c[9], tmp[9];
int main()
{
int n, x, y, z, m;
scanf("%d", &n);
while (n--) {
scanf("%s %s %s", a, b, c);
m = 1;
while (++m < 17) {
x = strtol(a, NULL, m);
y = strtol(b, NULL, m);
z = strtol(c, NULL, m);
if (x * y != z)
continue;
if (strcmp(a, itoa(x, tmp, m)))
continue;
if (strcmp(b, itoa(y, tmp, m)))
continue;
if (strcmp(c, itoa(z, tmp, m)))
continue;
break;
}
printf("%d\n", m < 17 ? m : 0);
}
return 0;
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator