QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#523915 | #7049. Base62 | qqbb | AC ✓ | 1ms | 3888kb | C++20 | 1.3kb | 2024-08-18 22:52:18 | 2024-08-18 22:52:18 |
Judging History
answer
#include <bits/stdc++.h>
#define qqbb ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define all(x) (x).begin(), (x).end()
#define int long long
#define endl '\n'
#define lb(x) x & -x
#define AA cerr<<"AA"<<endl;
using namespace std;
typedef pair<int, int> pii;
const int inf = 0x3f3f3f3f;
const int N = 2e5 + 10, M = 4e5 + 10;
int a[1010];
int ans[1010];
map<int,char> mp1;
map<char,int> mp2;
void solve(){
int x,y;string z;
cin>>x>>y>>z;
for(int i=0;i<=9;i++){
mp1[i] = '0' + i;
mp2['0' + i] = i;
}
for(int i=0;i<=25;i++){
mp1[i + 36] = 'a' + i;
mp1[i + 10] = 'A' + i;
mp2['a' + i] = i + 36;
mp2['A' + i] = i + 10;
}
for(int i=0;i<z.size();i++) a[i] = mp2[z[i]];
if(a[0] == 0){
cout<<0;return;
}
int j = 0,k = 0;
int len = z.size();
while(j < len){
for(int i = j; i < len-1; i++){
a[i+1] += a[i] % y * x;
a[i] /= y;
}
ans[k++] = a[len-1] % y;
a[len-1] /= y;
while(j < len && !a[j]) j++;
}
for(int i = 0; i < k; i++){
cout<<mp1[ans[k-i-1]];
}
}
signed main(){
qqbb;
// cout<<fixed<<setprecision(0);
int Test=1;
// cin>>Test;
while(Test--){
solve();
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3592kb
input:
16 2 FB
output:
11111011
result:
ok single line: '11111011'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
62 2 abcdefghiz
output:
11011100000100010111110010010110011111001001100011010010001
result:
ok single line: '11011100000100010111110010010110011111001001100011010010001'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
10 16 1234567890123456789012345678901234567890
output:
3A0C92075C0DBF3B8ACBC5F96CE3F0AD2
result:
ok single line: '3A0C92075C0DBF3B8ACBC5F96CE3F0AD2'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3584kb
input:
16 35 3A0C92075C0DBF3B8ACBC5F96CE3F0AD2
output:
333YMHOUE8JPLT7OX6K9FYCQ8A
result:
ok single line: '333YMHOUE8JPLT7OX6K9FYCQ8A'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
35 23 333YMHOUE8JPLT7OX6K9FYCQ8A
output:
946B9AA02MI37E3D3MMJ4G7BL2F05
result:
ok single line: '946B9AA02MI37E3D3MMJ4G7BL2F05'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3688kb
input:
23 49 946B9AA02MI37E3D3MMJ4G7BL2F05
output:
1VbDkSIMJL3JjRgAdlUfcaWj
result:
ok single line: '1VbDkSIMJL3JjRgAdlUfcaWj'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3852kb
input:
61 5 dl9MDSWqwHjDnToKcsWE1S
output:
42104444441001414401221302402201233340311104212022133030
result:
ok single line: '42104444441001414401221302402201233340311104212022133030'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3624kb
input:
5 10 42104444441001414401221302402201233340311104212022133030
output:
1234567890123456789012345678901234567890
result:
ok single line: '1234567890123456789012345678901234567890'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3888kb
input:
62 10 123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
output:
361097996547231939420324315862125604148156665886431480862914942937732101183106158332978897913678986703118641
result:
ok single line: '361097996547231939420324315862...6158332978897913678986703118641'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3660kb
input:
10 62 361097996547231939420324315862125604148156665886431480862914942937732101183106158332978897913678986703118641
output:
123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
result:
ok single line: '123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
Test #11:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
62 2 1000000000000
output:
101011101110010101110010000011101110100000110000011010000001000000000000
result:
ok single line: '101011101110010101110010000011...0110000011010000001000000000000'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3564kb
input:
62 2 0
output:
0
result:
ok single line: '0'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
62 2 zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
output:
101101010111011101011010100010010111100101010100101110001000001101101111000000111101111101011101101111010000100001111110100110110110001101010010101000000011010000100100110101000110110010001110001011001111001100001101010010001111001100110100110110111101001010111100010010011111110111111000010011110010...
result:
ok single line: '101101010111011101011010100010...1111111111111111111111111111111'