QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#164192 | #4274. $2x + 2$ | raymond_7 | WA | 0ms | 1696kb | C++14 | 529b | 2023-09-04 20:36:28 | 2023-09-04 20:36:29 |
Judging History
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'