QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#783131 | #8048. Roman Master | Ludovica | Compile Error | / | / | C++14 | 803b | 2024-11-25 23:51:49 | 2024-11-25 23:51:50 |
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,n[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<n[j].size()-1)
continue;
bool flag=1;
for(int k=0;k<n[j].size();k++){
if(s1[i-k]!=n[j][n[j].size()-1-k]){
flag=0;
break;
}
}
if(flag){
a[++tmp]=num[j];
l=i-n[j].size();
break;
}
}
}
for(int i=tmp;i>=1;i--)
cout<<a[i];
cout<<"\n";
}
int main(){
cin>>T;
while(T--){
cin>>s1;
solve();
}
return 0;
}
Details
answer.code: In function ‘void solve()’: answer.code:12:31: error: invalid types ‘int[int]’ for array subscript 12 | if(i<n[j].size()-1) | ^ answer.code:15:28: error: invalid types ‘int[int]’ for array subscript 15 | for(int k=0;k<n[j].size();k++){ | ^ answer.code:16:30: error: invalid types ‘int[int]’ for array subscript 16 | if(s1[i-k]!=n[j][n[j].size()-1-k]){ | ^ answer.code:16:35: error: invalid types ‘int[int]’ for array subscript 16 | if(s1[i-k]!=n[j][n[j].size()-1-k]){ | ^ answer.code:23:22: error: invalid types ‘int[int]’ for array subscript 23 | l=i-n[j].size(); | ^