https://vjudge.net/problem/UVA-10494
这个题我之前的bug是,对于第二个数是个位数的时候
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cctype>
#include<cstring>
#include<fstream>
#include<map>
using namespace std;
#define ll unsigned long long
const int N=100000;
char x[N];
int ans[N];
ll y;
int main(){
char op[3];
while(scanf("%s%s%lld",x,&op,&y)!=EOF){
ll ret=0;
memset(ans,0,sizeof(ans));
for(int i=0;i<strlen(x);i++){
ret=ret*10+x[i]-'0';
ans[++ans[0]]=ret/y;
ret%=y;
}
if(op[0]=='/'){
int k=1;
while(!ans[k]&&k<=ans[0])k++;
if(k>ans[0])
printf("0");
else while(k<=ans[0])
printf("%d",ans[k]);
}else
cout<<ret;
puts("");
}
return 0;
}