QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#74718 | #5006. Heximal | XKError# | WA | 3ms | 5652kb | C++14 | 709b | 2023-02-03 15:17:43 | 2023-02-03 15:17:44 |
Judging History
answer
#include <bits/stdc++.h>
#define ll long long
using namespace std;
char s[5000005];
//long double log10(long double x) {
// return log(x) / log(10);
//}
int main() {
scanf("%s", s);
int n = strlen(s);
// cout<<n<<endl;
if (n == 1 && s[0] == '0') return puts("1"), 0;
ll res = 0;
if (n <= 18) {
for (int i = 0; i < n; i++) res = res * 10 + s[i] - '0';
int ans = log((long double)res) / log(6) + 1;
printf("%d\n", ans);
}
else {
for (int i = 0; i < 18; i++) res = res * 10 + s[i] - '0';
// cout<<res<<" "<<n - 18<<" "<<log10((long double)res) + n - 18<<endl;
int ans = (log10((long double)res) + n - 18) / log10(6) + 1;
printf("%d\n", ans);
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 2ms
memory: 3296kb
input:
0
output:
1
result:
ok single line: '1'
Test #2:
score: 0
Accepted
time: 3ms
memory: 3536kb
input:
1865
output:
5
result:
ok single line: '5'
Test #3:
score: 0
Accepted
time: 2ms
memory: 3536kb
input:
6
output:
2
result:
ok single line: '2'
Test #4:
score: 0
Accepted
time: 2ms
memory: 3536kb
input:
5
output:
1
result:
ok single line: '1'
Test #5:
score: 0
Accepted
time: 2ms
memory: 3556kb
input:
216
output:
4
result:
ok single line: '4'
Test #6:
score: -100
Wrong Answer
time: 3ms
memory: 5652kb
input:
659048550435237232393875796171343597297252783860791224966151609834498375660891507785647188078990198766575546966667938541517709208360385263203130845215396367798902376853652489767206051858708602045962531467486884777174160264291462611744982439094276291073422016146183934443085743192727084631329374278797...
output:
123576
result:
wrong answer 1st lines differ - expected: '123577', found: '123576'