QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#492530#8048. Roman MasterHanZhongBalls#WA 13ms3728kbC++141.2kb2024-07-26 13:13:322024-07-26 13:13:33

Judging History

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

  • [2024-07-26 13:13:33]
  • 评测
  • 测评结果:WA
  • 用时:13ms
  • 内存:3728kb
  • [2024-07-26 13:13:32]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
#define F first
#define S second
#define random(x) (rand() % (x))
#define LOG(a, b) (log(a) / log(b))
#define N 1000005
#define mod 998244353
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3fll
char s[N],a[N];
int n,l=9;
int main(){
	int T;
	scanf("%d",&T);
	while(T--){
		scanf("%s",s);n=strlen(s);
		l=0;
		for(int i=n-1;i>=0;--i){
			//printf("A%d\n",i);
			if(s[i]=='I'){
				if(i==0){a[l++]='1';continue;}
				--i;
				if(s[i]=='I'){
					if(i==0){
						a[l++]='2';continue;
					}
					--i;
					if(s[i]=='I'){
						if(i==0){
							a[l++]='3';continue;
						}
						if(s[i-1]=='I'){
							a[l++]='3';continue;
						}else{
							a[l++]='8';
							--i;
							continue;
						}
					}else{
						a[l++]=7;
						continue;
					}
				}else{
					a[l++]='6';
					continue;
				}
			}else{
				if(i>0&&s[i-1]=='I'){
					a[l++]='4';
					--i;
				}else{
					a[l++]='5';
				}
			}
		}
		//printf("l=%d\n",l);
		a[l]=0;
		reverse(a,a+l);
		puts(a);
	}
	return 0;
}
/*
3
II
IVI
VIIIIIV

*/

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
II
IVI
VIIIIIV

output:

2
16
634

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 13ms
memory: 3728kb

input:

100000
VVIVVVVVII
VVVIIIIVVI
IVIIVIIIIV
VVVVVIIVVI
IIIVIVVVIV
VIVIIIIIVI
VVIIVVIVVI
IVVVIVVVVV
VIIVVVVIVV
VIIIIVVVVV
VVVVVVIVIV
VIVIIIVVVI
VIIIVIVVVI
VIIIIVVIIV
VIVVVIIVII
IIIIIVIIVI
IIIIVVVVII
IVIIVVIIVI
IVVIVVIIIV
IVVVIIIVIV
IIIIVIIIVV
VVVVVIVIIV
VVVIIIIVVV
VIVVIIIIVI
VIIIIIIIIV
VIVIVVVIVV
IVIIIVI...

output:

554555\x07
55846
1\x0784
5555646
244554
6\x0736
564546
45545555
6455545
845555
55555544
6\x07456
\x074456
8464
545\x07\x07
23\x076
3455\x07
164\x076
454\x074
45\x0744
13\x0745
5555664
558455
54636
6334
5445545
1863
2\x07645
34645
54\x0746
55556455
46345
3\x0746
\x074546
6633
5455544
\x0738
4\x07\x076
8666
1455445
555555556
44444
456445
5\x0733
488
5455544
6336
...

result:

wrong answer 1st lines differ - expected: '5545557', found: '554555\x07'