QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#74721 | #5006. Heximal | XKError# | WA | 2ms | 3580kb | C++14 | 863b | 2023-02-03 15:28:17 | 2023-02-03 15:28:20 |
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;
ll tmp = 0;
ll ans = 0;
if (n <= 18) {
for (int i = 0; i < n; i++) res = res * 10 + s[i] - '0';
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;
ans = (log10((long double)res) + n - 18) / log10(6) + 1;
// printf("%d\n", ans);
}
for (int i = 0; i < n; i++) tmp = (tmp * 10 + s[i] - '0') % 21936950640377856ll;
if (tmp < 1e9) ++ans;
printf("%d\n", ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 2ms
memory: 3580kb
input:
0
output:
1
result:
ok single line: '1'
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3524kb
input:
1865
output:
6
result:
wrong answer 1st lines differ - expected: '5', found: '6'