社区讨论

满江红代码求调 悬一关

P8964梦幻 | Reopening of Dream参与者 2已保存回复 2

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
2 条
当前快照
1 份
快照标识符
@lo36014q
此快照首次捕获于
2023/10/24 01:21
2 年前
此快照最后确认于
2023/10/24 01:21
2 年前
查看原帖
如下:
CPP
#include<bits/stdc++.h>
#define PD (r!="freopen(\""+q[j]+".in\",\"r\",stdin);")||(w!="freopen(\""+q[j]+".out\",\"r\",stdout);")
using namespace std;
int main(){
    int t,n,m,ren;
    string q[5],r,w;
    cin>>t>>n>>m;
    for(int i=1;i<=m;i++){
        cin>>q[i];
    }
    for(int i=1;i<=n;i++){
        ren=1;
        for(int j=1;j<=m;j++){
            cin>>r>>w;
            if((r.size()>=10&&r.substr(0,10)=="//freopen("&&r.substr(r.size()-2)==");")||(w.size()>=10&&w.substr(0,10)=="//freopen("&&w.substr(w.size()-2)==");")){
                ren=3;//见祖宗人判断
            }
            else if(PD==1){//乐子人判断
                ren=max(ren,2);
                //cout<<PD;
            }
        }
        if(ren==1){//普通人
            cout<<"PION2202 RP++."<<endl;
        }
        else if(ren==2){//乐子人
            cout<<"Good luck and have fun."<<endl;
        }
        else{//见祖宗人
            cout<<"Wrong file operation takes you to your ancestors along with your 3 years' efforts on OI."<<endl;
        }
    }
    
    return 0;
}
错误貌似是会把所有普通人判断成乐子人。
而且有一件特别诡异的事情,当我在乐子人判断中加入调试语句cout<<PD;时,有时会输出0。我也不知道if到底是怎么运行的

回复

2 条回复,欢迎继续交流。

正在加载回复...