| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 118371 | 梁颢城 | 十进制转d进制 | C++ | Accepted | 100 | 0 MS | 248 KB | 407 | 2023-12-30 10:27:48 |
#include<bits/stdc++.h> #define int long long using namespace std; string sb = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; char a[1000010]; signed main(){ int n,d; cin >> n >> d; int sum = n; int cnt = 0; while(sum != 0){ a[cnt] = sb[sum % d]; sum = (sum - a[sb[cnt]])/d; cnt++; } for(int i = cnt-1; i >= 0;i--){ cout << a[i]; } if(n == 0){ cout << 0; } return 0; }