代码错了,好心人帮帮我!
查看原帖
代码错了,好心人帮帮我!
1185634
xiandai_pengyuhe楼主2024/11/19 22:14
#include<bits/stdc++.h>
using namespace std;
int a[100000][5];
string s;
int main(){
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>s;
		for(int j=0;j<s.size();j++){
			if(s[j]=='A'||s[j]=='B'||s[j]=='C'||s[j]=='D'||s[j]=='E'||s[j]=='F'){
				a[i][1]=0;
				a[i][2]=0;
				a[i][3]=0;
				a[i][4]=1;
				a[i][0]=16;
			}if((s[j]=='9'||s[j]=='8')&&a[i][0]!=16){
				a[i][1]=0;
				a[i][2]=0;
				a[i][3]=1;
				a[i][4]=1;
				a[i][0]=10;
			}if((s[j]=='7'||s[j]=='6'||s[j]=='5'||s[j]=='4'||s[j]=='3'||s[j]=='2')&&s[i]!=10&&s[i]!=16){
				a[i][1]=0;
				a[i][2]=1;
				a[i][3]=1;
				a[i][4]=1;
				a[i][0]=8;
			}if((s[j]=='1'||s[j]=='0')&&a[i][0]==0){
				a[i][1]=1;
				a[i][2]=1;
				a[i][3]=1;
				a[i][4]=1;
			}
			}
		}
		//cout<<a[i].s<<endl;
	
	for(int i=1;i<=n;i++){
		for(int j=1;j<=4;j++){
			cout<<a[i][j]<<" ";
		}cout<<"\n";
	}
	return 0;
}

2024/11/19 22:14
加载中...