社区讨论
全错,求大佬教一下(P8964)
P8964梦幻 | Reopening of Dream参与者 2已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @mmc0ys5d
- 此快照首次捕获于
- 2026/03/04 20:40 6 天前
- 此快照最后确认于
- 2026/03/07 13:55 3 天前
#include
#include
#include
#include
using namespace std;```cpp
#include
#include
#include
#include
using namespace std;
int main()
{
int T,n,m;
cin>>T>>n>>m;
cin.ignore();
int i;
vectora1;
while(m--)
{
string a;
cin>>a;
a1.push_back(a);
}
m=a1.size();
int j;
string b1="stdin";
string b2="stdout";
string b3="//";
for(i=1;i<=n;i++)
{
string a3;
getline(cin,a3);
bool use=false;
bool use1=true;
for(j=1;j<=2*m;j++)
{
string a2;
getline(cin,a2);
int t=a2.size();
int p=j/2;
if(t>=10&&a2.substr(0,10)=="//freopen("&&a2.substr(t-2)==");")
{
use=true;
continue;
}
else
{
if(j%2!=0)
{
if(a2!="freopen("" + a1[p] + ".in", "r", stdin);")
{
use1=false;
}
}
else
{
if(a2!="freopen("" + a1[p] + ".out", "w", stdout);")
{
use1=false;
}
}
}
}
if(use)
{
cout<<"Wrong file operation takes you to your ancestors along with your 3 years' efforts on OI."<<endl;
}
else if(use1)
{
cout<<"PION2202 RP++."<<endl;
}
else
{
cout<<"Good luck and have fun."<<endl;
}
}
}
CPP
int main()
{
int T,n,m;
cin>>T>>n>>m;
cin.ignore();
int i;
vector<string>a1;
while(m--)
{
string a;
cin>>a;
a1.push_back(a);
}
m=a1.size();
int j;
string b1="stdin";
string b2="stdout";
string b3="//";
for(i=1;i<=n;i++)
{
string a3;
getline(cin,a3);
bool use=false;
bool use1=true;
for(j=1;j<=2*m;j++)
{
string a2;
getline(cin,a2);
int t=a2.size();
int p=j/2;
if(t>=10&&a2.substr(0,10)=="//freopen("&&a2.substr(t-2)==");")
{
use=true;
continue;
}
else
{
if(j%2!=0)
{
if(a2!="freopen(\"" + a1[p] + ".in\", \"r\", stdin);")
{
use1=false;
}
}
else
{
if(a2!="freopen(\"" + a1[p] + ".out\", \"w\", stdout);")
{
use1=false;
}
}
}
}
if(use)
{
cout<<"Wrong file operation takes you to your ancestors along with your 3 years' efforts on OI."<<endl;
}
else if(use1)
{
cout<<"PION2202 RP++."<<endl;
}
else
{
cout<<"Good luck and have fun."<<endl;
}
}
}
回复
共 1 条回复,欢迎继续交流。
正在加载回复...