60pt,第三个子任务不对,求调
查看原帖
60pt,第三个子任务不对,求调
651883
hwh_qwq楼主2024/5/9 19:46
#include<iostream>
using namespace std;
string a[10],b[10];
string c="//freopen(";
int main(){
    int t,n,m;
    cin>>t>>n>>m;
    for(int i=1;i<=m;i++){
    	string s;
    	cin>>s;
    	a[i]="freopen("; b[i]="freopen(";
    	a[i]=a[i]+'"'+s+".in"+'"'+','+'"'+'r'+'"'+",stdin);";
    	b[i]=b[i]+'"'+s+".out"+'"'+','+'"'+'w'+'"'+",stdout);";
    	//cout<<a[i]<<" "<<b[i]<<endl;
	}
	for(int i=1;i<=n;i++){
		int f=0;
		for(int j=1;j<=m;j++){
			string s1,s2;
			cin>>s1>>s2;
			if(f!=0) continue;
			if(s1==a[j]&&s2==b[j]) continue;
			else{
				string s3="";
				//if(s1.size()<10||s2.size()<10){
				//	f=2;
				//	continue;
				//}
				for(int k=0;k<=9;k++) s3+=s1[k];
				if(s3==c&&s1[s1.size()-1]==';'&&s1[s1.size()-2]==')'){
					f=1;
					continue;
				}
				s3="";
				for(int k=0;k<=9;k++) s3+=s2[k];
				if(s3==c&&s2[s2.size()-1]==';'&&s2[s2.size()-2]==')'){
					f=1;
					continue;
				}
				f=2;
			}
		}
		if(f==0) cout<<"PION2202 RP++."<<endl;
		else if(f==1) cout<<"Wrong file operation takes you to your ancestors along with your 3 years' efforts on OI."<<endl;
		else cout<<"Good luck and have fun."<<endl;
	}
    return 0;
}
2024/5/9 19:46
加载中...