社区讨论
求助
P3692夏幻的考试参与者 2已保存回复 1
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 1 条
- 当前快照
- 1 份
- 快照标识符
- @lo338xm9
- 此快照首次捕获于
- 2023/10/24 00:04 2 年前
- 此快照最后确认于
- 2023/10/24 00:04 2 年前
CPP
#include<bits/stdc++.h>
using namespace std;
int t,n;
string ss;
string w;
bool flag=true;
string y;
char c;
string s[60];
string A="1000",B="0100",C="0010",D="0001";
int sum=0;
double point,grade;
void a(){
for (int i=1;i<=16;i++){
cin>>c;
if(c-'0'==1) sum+=pow(2,16-i);
}
if(sum>=1 and sum<=10000) cout<<"ID:"<<sum<<endl;
else {
flag=false;
cout<<"Wrong ID"<<endl;
}
return ;
}
void check(char x){
cin>>y;
if(flag==false) return ;
else
if((x=='0'&&y=="10") or (x=='1'&&y=="01")) cout<<"Type Correct"<<endl;
else cout<<"Type Incorrect"<<endl;
return;
}
void end(){
grade=100.00;
for (int i=1;i<=n;i++){
cin>>y;
if(y!=s[i]) grade-=point;
}
if(flag==false) return ;
printf("%.1lf\n",grade);
return ;
}
int main(){
cin>>t>>n;
cin>>w;
for (int i=0;i<n;i++){
if(w[i]=='A') s[i+1]=A;
else if(w[i]=='B') s[i+1]=B;
else if(w[i]=='C') s[i+1]=C;
else s[i+1]=D;
}
point=100.00/n;
for (int i=1;i<=t;i++){
flag=true;
a();
check(c);
end();
cout<<endl;
}
return 0;
}
回复
共 1 条回复,欢迎继续交流。
正在加载回复...