QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#164182#4274. $2x + 2$raymond_7WA 0ms1744kbC++14451b2023-09-04 20:33:482023-09-04 20:33:49

Judging History

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

  • [2023-09-04 20:33:49]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1744kb
  • [2023-09-04 20:33:48]
  • 提交

answer

#include <cstdio>
#include <cstring>
#define For(i, l, r) for(int i = l; i <= r; i ++)

using namespace std;

const int N = 110;

int n, a[N];
char s[N];

int main()
{
	scanf("%s", s + 1); n = strlen(s + 1);
	For(i, 1, n) a[i] = (s[n - i + 1] - '0') * 2;
	a[1] += 2;
	a[0] = n;
	for(int i = n; i ; i --)
	{
		a[i - 1] += a[i] % 3 * 10;
		a[i] /= 3;
	}
	while(!a[a[0]]) a[0] --;
	For(i, 1, a[0]) printf("%d", a[a[0] - i + 1]);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 1744kb

input:

4

output:

3

result:

ok answer is '3'

Test #2:

score: 0
Accepted
time: 0ms
memory: 1700kb

input:

10000000000

output:

6666666667

result:

ok answer is '6666666667'

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 1600kb

input:

11537

output:

76812

result:

wrong answer expected '7692', found '76812'