QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#783136 | #8048. Roman Master | Ludovica | Compile Error | / | / | C++14 | 807b | 2024-11-25 23:54:29 | 2024-11-25 23:54:30 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int T;
int num[9]={0,1,2,3,5,4,6,7,8};
string s1,b[10]={"","I","II","III","V","IV","VI","VII","VIII"};
int a[N];
void solve()
{
int n=s1.size(),tmp=0;
for(int i=n-1,l=i;i>=0;i=l){
for(int j=8;j>=1;j--){
if(i<b[j].size()-1)
continue;
bool flag=1;
for(int k=0;k<b[j].size();k++){
if(s1[i-k]!=b[j][b[j].size()-1-k]){
flag=0;
break;
}
}
if(flag) {
a[++tmp]=num[j];
l=i-b[j].size();
break;
}
}
}
for(int I=tmp;i>=1;i--)
cout<<a[i];
cout<<endl;
}
int main(){
cin>>T;
while(T--){
cin>>s1;
solve();
}
return 0;
}
Details
answer.code: In function ‘void solve()’: answer.code:29:23: error: ‘i’ was not declared in this scope 29 | for(int I=tmp;i>=1;i--) | ^