ooo)(00000)(ooo

B3849 [GESP样题 三级] 进制转换

Oscar111111 @ 2024-07-16 14:20:14

0分

#include <bits/stdc++.h>
using namespace std;
char s[1001]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char ans[10001];
int main()
{
    int x,m;
    cin>>x>>m;
    int i=0;
    while(x!=0){
        int t=x%m;
        x=x/m;
        ans[i++]=s[t];
        i++;
    }
    for(int j=i-1;j>=0;j--)
        cout<<ans[j];
    return 0;
}

WA WA WA WA WA

B2143 和 B3849 一模一样!!!


by kuailedetongnian @ 2024-07-16 14:22:54

ans[i++]=s[t];
i++;

i 加了两次


|