1 条题解

  • 0
    @ 2024-3-9 11:04:48
    #include<iostream> 
    using namespace std;
    int main(){ //C++ L17 合法标识符
    	int n;
    	cin>>n;
    	bool bz;
    	for(int i=0;i<n;i++){
    		bz=true;
    		string s;
    		cin>>s;
    		for(int j=0;j<s.length();j++){
    			if(isdigit(s[j]) or isalpha(s[j]) or s[j]=='_')
    				;
    			else
    				bz=false;
    			if(isdigit(s[0]))
    				bz=false;
    		}
    		if(bz)
    			cout<<"Yes\n";
    		else
    			cout<<"No\n";
    	}
    	return 0;
    }
    
    • 1

    信息

    ID
    1194
    时间
    1000ms
    内存
    256MiB
    难度
    9
    标签
    (无)
    递交数
    9
    已通过
    8
    上传者