社区讨论
为什么错了啊
P2580于是他错误的点名开始了参与者 4已保存回复 7
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 7 条
- 当前快照
- 1 份
- 快照标识符
- @mhjbdw46
- 此快照首次捕获于
- 2025/11/03 23:48 4 个月前
- 此快照最后确认于
- 2025/11/03 23:48 4 个月前
代码如下
CPP#include<iostream>
#include <algorithm>
#include<vector>
#include<string>
using namespace std;
vector<string> name;
bool namec[10005];
int main(){
int n;
cin>>n;
for(int i=1;i<=n;i++){
string s;
cin>>s;
name.push_back(s);
}
int m;
cin>>m;
for(int i=1;i<=m;i++){
string t;
cin>>t;
int d=find(name.begin(),name.end(),t);
if (d!=name.end()){
if(namec[d]){
cout<<"REPEAT"<<endl;
}else{
namec[d]=1;
cout<<"OK"<<endl;
}
}else{
cout<<"WRONG"<<endl;
}
}
return 0;
}
(我是第一次用vector,非常不熟练)
回复
共 7 条回复,欢迎继续交流。
正在加载回复...