题目链接:https://www.luogu.com.cn/problem/P1143
//代码错误,输出0分,看不出来,有空再改
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; int n, m; inline int isint(char c){ if (c >= 'A' && c <= 'F') return c - 'A' + 10; if (c >= '0' && c <= '9') return c - '0'; return -1; } inline int read(){ int s = 0; char c = getchar(); //while (~isint(c)) s = s*n + isint(c), c = getchar(); while (~isint(c)) s = s*n + isint(c), c = getchar(); return s; } inline char cov(int s){ if (s < 10) return s + '0'; return s - 10 + 'A'; } void otp(int s){//otp是output if (!s) return; otp(s / m); putchar(cov(s % m)); } int main(){ cin >> n; getchar(); long long t = read(); cin >> m; otp(t); putchar('\n'); return 0; }