UOJ Logo

NOI.AC

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#171356#993. R-十进制heyuzhen1002ms1240kbC++281b2023-06-22 21:54:592023-06-22 21:55:00

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long
string s;
ll n,ans;
int main(){
	cin>> n >> s;
	for(ll i = 0;i < s.length();i++){
		if(!isdigit(s[i]))s[i] = s[i] - 'A' + 10;
		else s[i] -= '0';
		ans = ans * n + s[i];
	}cout << ans;
	return 0;
}


详细

小提示:点击横条可展开更详细的信息

Test #1:

score: 10
Accepted
time: 0ms
memory: 1232kb

input:

32
E8

output:

456

result:

ok single line: '456'

Test #2:

score: 10
Accepted
time: 0ms
memory: 1240kb

input:

16
AD52

output:

44370

result:

ok single line: '44370'

Test #3:

score: 10
Accepted
time: 0ms
memory: 1236kb

input:

35
58AB81

output:

275056881

result:

ok single line: '275056881'

Test #4:

score: 10
Accepted
time: 0ms
memory: 1236kb

input:

4
131131331102311

output:

494392501

result:

ok single line: '494392501'

Test #5:

score: 10
Accepted
time: 0ms
memory: 1236kb

input:

16
194C7C1E

output:

424442910

result:

ok single line: '424442910'

Test #6:

score: 10
Accepted
time: 1ms
memory: 1236kb

input:

36
H3TRMK

output:

1034352668

result:

ok single line: '1034352668'

Test #7:

score: 10
Accepted
time: 1ms
memory: 1240kb

input:

17
1BE57C5

output:

40952087

result:

ok single line: '40952087'

Test #8:

score: 10
Accepted
time: 0ms
memory: 1240kb

input:

16
C6A8652

output:

208307794

result:

ok single line: '208307794'

Test #9:

score: 10
Accepted
time: 0ms
memory: 1240kb

input:

22
7A97GFF

output:

847386577

result:

ok single line: '847386577'

Test #10:

score: 10
Accepted
time: 0ms
memory: 1240kb

input:

7
23446600641

output:

713171754

result:

ok single line: '713171754'