0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-23 22:48:48 +00:00
Baoshuo Ren 2021-09-26 20:33:43 +08:00 committed by Baoshuo Ren
parent 6624bda3c4
commit ceaf708b95
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

51
AtCoder/ABC220/B/B.cpp Normal file
View File

@ -0,0 +1,51 @@
#include <bits/stdc++.h>
using namespace std;
int k;
long long aa, bb, x;
string a, b;
int ctoi(char c) {
int r;
switch (c) {
case 'A':
r = 10;
break;
case 'B':
r = 11;
break;
case 'C':
r = 12;
break;
case 'D':
r = 13;
break;
case 'E':
r = 14;
break;
case 'F':
r = 15;
break;
default:
r = c - '0';
break;
}
return r;
}
int main() {
cin >> k >> a >> b;
x = 1;
for (int i = a.size() - 1; i >= 0; i--) {
aa += ctoi(a[i]) * x;
x *= k;
}
x = 1;
for (int i = b.size() - 1; i >= 0; i--) {
bb += ctoi(b[i]) * x;
x *= k;
}
cout << aa * bb << endl;
return 0;
}