QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#74720#5006. HeximalXKError#Compile Error//C++14849b2023-02-03 15:27:032023-02-03 15:27:05

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:27:05]
  • 评测
  • [2023-02-03 15:27:03]
  • 提交

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

answer.code: In function ‘int main()’:
answer.code:22:17: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   22 |                 ans = log((long double)res) / log(6) + 1;
      |                 ^~~
      |                 abs
answer.code:28:17: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   28 |                 ans = (log10((long double)res) + n - 18) / log10(6) + 1;
      |                 ^~~
      |                 abs
answer.code:32:26: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   32 |         if (tmp < 1e9) ++ans;
      |                          ^~~
      |                          abs
answer.code:33:24: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
   33 |         printf("%d\n", ans);
      |                        ^~~
      |                        abs
answer.code:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         scanf("%s", s);
      |         ~~~~~^~~~~~~~~