| ||||||||||
| 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 <cstdio>
const int MAX = 100;
int main()
{
int test, t, i, arr[MAX], co, pro;
for(scanf("%d", &test); test--; ){
scanf("%d%d", &t, arr);
if(t == 1){
printf("%d\n", arr[0]);
continue;
}
if(arr[0] == 1){
puts("0");
continue;
}
co = 0;
for(i = 1; i < MAX; ++i){
pro = arr[i-1] * t + co;
arr[i] = pro % 10;
co = pro / 10;
if(arr[i] != 0 && arr[i]*t + co == arr[0]) break;
}
if(i == MAX) puts("0");
else{
for(; i >= 0; --i) printf("%d", arr[i]);
puts("");
}
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator