QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#164192#4274. $2x + 2$raymond_7WA 0ms1696kbC++14529b2023-09-04 20:36:282023-09-04 20:36:29

Judging History

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

  • [2023-09-04 20:36:29]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:1696kb
  • [2023-09-04 20:36:28]
  • 提交

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(i, 1, n + 1) a[i + 1] += a[i] / 10, a[i] %= 10;
	if(a[n + 1]) a[0] ++;
	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: 0
Wrong Answer
time: 0ms
memory: 1696kb

input:

4

output:

10

result:

wrong answer expected '3', found '10'