玄关求跳555555555
查看原帖
玄关求跳555555555
1059688
ja_son楼主2025/1/22 11:17

rt 落谷说答案第三行太短(也就是输出答案的那一行)

不知道为什么 怎么改啊大佬们

#include <bits/stdc++.h>
using namespace std;

int T,n;
string s,b;
string a,ans;
string text;


int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>T>>n;
	cin>>b;
	for(int i=0;i<T;i++){
		int sum=0;
		bool tf=true;
		int num=0;
		cin>>s;
		cin>>text;
		int lens=s.size();
		reverse(s.begin(),s.end());
		for(int j=0;j<lens;j++){
			if(s[j]=='1'){
				num=num+pow(2,j);
			}
		}
		reverse(s.begin(),s.end());
		if(num<=0 || num>10000){
			cout<<"Wrong ID"<<endl;
			cout<<endl;
			tf=false;
		}
		else{
			cout<<"ID: "<<num<<endl;
		}
		if(tf){
			if(text=="01" && s[15]=='1'){
				cout<<"Type Correct"<<endl;
			}
			else if(text=="10" && s[15]=='0'){
				cout<<"Type Correct"<<endl;
			}
			else{
				cout<<"Type Incorrect"<<endl;
			}
		}
		double point=100.0/n;
		for(int j=0;j<n;j++){
			cin>>ans;
			if(tf){
				char eans;
				if(ans=="1000"){
					eans='A';
				}
				else if(ans=="0100"){
					eans='B';
				}
				else if(ans=="0010"){
					eans='C';
				}
				else if(ans=="0001"){
					eans='D';
				}
				else{
					continue;
				}
				if(eans==b[j]){
					sum++;
				}
			}
		}
		point=sum*point;
		if(tf){
			printf("%.1lf\n",point);
			cout<<endl;
		}
	}
	return 0;
}
2025/1/22 11:17
加载中...