Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
44224 | 惠子铭 | 合法C标识符 | C++ | Accepted | 1 MS | 248 KB | 390 | 2024-03-29 15:38:51 |
#include<iostream> #include<cstring> using namespace std; char a[21]; int main() { cin>>a; bool flag=1; if('0'<=a[0]&&a[0]<='9'){ cout<<"no"; flag=0; } else{ for(int i=0;i<strlen(a);i++){ if(!(('A'<=a[i]&&a[i]<='z')||(a[i]=='_')||('0'<=a[i]&&a[i]<='9'))){ cout<<"no"; flag=0; break; } } } if(flag==1){ cout<<"yes"; } return 0; }