Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
44304 | chenyanda | 合法C标识符 | C++ | Compile Error | 0 MS | 0 KB | 332 | 2024-03-29 17:38:48 |
#include<iostream> #include<cstring> using namespace std; int main() { char s[20],cnt=0; cin>>s; for(int i=0;i<strlen(s)-1;i++){ if(s[i]>='A'&&s[i]<='Z'||s[i]>='a'&&s[i]<='z'){ cnt++; } } if(strlen(s)==cnt&&s[0]<'0'||strlen(s)==cnt&&s[0]>'9'||s[i]=='_'){ cout<<"yes"; } else{ cout<<"no"; } }