QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#74718#5006. HeximalXKError#WA 3ms5652kbC++14709b2023-02-03 15:17:432023-02-03 15:17:44

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-02-03 15:17:44]
  • 评测
  • 测评结果:WA
  • 用时:3ms
  • 内存:5652kb
  • [2023-02-03 15:17:43]
  • 提交

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;
}

Details

Tip: Click on the bar to expand more detailed information

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'