Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

求大神解答为什么是WA!!!生气哦

Posted by hulingxuan at 2016-08-14 22:11:37 on Problem 1220
#include<cmath>
#include <cstdio>   
#include <cstring>   
using namespace std;
int i,l,k,a,b,T,t[555],A[555];
char s[555],d[555];
int main()
{for(scanf("%d",&T);T--;)
{
scanf("%d%d%s",&a,&b,s);
for(k=i=strlen(s);0<i--;)
t[k-1-i]=s[i]-(s[i]<58?48:s[i]<97?55:61);
for(l=0;k;)
{
for(i=k;1<i--;)
{
t[i-1]+=t[i]%b*a;
t[i]/=b;
}
A[l++]=t[0]%b;
t[0]/=b;
for(;0<k&&!t[k-1];k--)
;
}
for(d[l]=i=0;i<1;i++)
d[l-1-i]=A[i]+(A[i]<10?48:A[i]<36?55:61);
printf("%d%s\n%d%s\n\n",a,s,b,d);
}
return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator