QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#715190#8048. Roman Masternihaoakeke1WA 63ms3532kbC++14931b2024-11-06 10:45:072024-11-06 10:45:09

Judging History

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

  • [2024-11-06 10:45:09]
  • 评测
  • 测评结果:WA
  • 用时:63ms
  • 内存:3532kb
  • [2024-11-06 10:45:07]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int T;
    cin>>T;
    while(T--){
        int n;
        //cin>>n;
        string s;
        cin>>s;
        n=s.size();
        string ans;
        for(int i=0;i<n;){
            if(s[i]=='V'){
                i++;
                if(i==n||s[i]=='V') ans+='5';
                else ans+='4',i++;
            }else{
                i++;
                if(i==n) ans+='1';
                else if(s[i]=='I'){
                    i++;
                    if(i==n) ans+='2';
                    else if(s[i]=='I') {
                        i++;
                        if(i==n||s[i]=='I') ans+='3';
                        else ans+='8',i++;
                    }
                    else ans+='7',i++;
                }else ans+='6',i++;
            }
        }
        reverse(ans.begin(),ans.end());
        cout<<ans<<"\n";
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
II
IVI
VIIIIIV

output:

2
16
634

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 63ms
memory: 3532kb

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:

14555545
48455
6376
4645555
54568
16344
454645
55555456
5545564
555584
54455555
45744
45674
6484
264554
1773
145563
16476
74546
67456
5863
6445555
558455
18454
6334
5545544
1386
5777
56463
47454
55645555
56346
488
45474
3344
5445554
3634
17646
16674
554457
455555555
66666
566456
13345
3746
5445554
1...

result:

wrong answer 1st lines differ - expected: '5545557', found: '14555545'