1 条题解

  • 1
    @ 2026-1-6 16:57:01
    #include<bits/stdc++.h>
    #define int long long
    using namespace std;
    int A,a,t[2000005],x;
    string s;
    bool _(int x){
    	cin.tie(0);
    	cout.tie(0);
    	int s=0;
    	for(int j=1;j<=x;j++){
    		if(t[j]!=1&&t[j]!=6)s++;
    	}
    	if(s==0)return false;
    	s=0;
    	for(int j=1;j<=x;j++){
    		if(t[j]!=2&&t[j]!=7)s++;
    	}
    	if(s==0)return false;
    	s=0;
    	for(int j=1;j<=x;j++){
    		if(t[j]!=3&&t[j]!=8)s++;
    	}
    	if(s==0)return false;
    	s=0;
    	for(int j=1;j<=x;j++){
    		if(t[j]!=4&&t[j]!=9)s++;
    	}
    	if(s==0)return false;
    	s=0;
    	for(int j=1;j<=x;j++){
    		if(t[j]!=5&&t[j]!=0)s++;
    	}
    	if(s==0)return false;
    	return true;
    }
    signed main(){
    	cin>>A;
    	while(A--){
    		cin>>a;
    		x=0;
    		for(int i=1;i<=a;i++){
    			cin>>s;
    			for(int j=s.size()-1;j>=0;j--){
    				if(s[j]>='0'&&s[j]<='9'){
    					t[++x]=s[j]-'0';
    					break;
    				}   
    			}		
    		}
    		if(_(x))cout<<"YES";
    		else cout<<"NO";
    		cout<<"\n";
    	}
        return 0;
    }
    
    
    • 1

    信息

    ID
    3821
    时间
    1000ms
    内存
    128MiB
    难度
    6
    标签
    (无)
    递交数
    75
    已通过
    26
    上传者