Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
44232 | 奚晨瑞 | 合法C标识符 | C++ | Accepted | 0 MS | 244 KB | 397 | 2024-03-29 15:40:46 |
#include<iostream> #include<cstring> using namespace std; char a[21]; int main() { cin>>a; int b=strlen(a); bool y=1; if('0'<=a[0]&&a[0]<='9'){ y=0; } else{ for(int i=0;i<b;i++){ if(('A'<=a[i]&&a[i]<='z')||('0'<=a[i]&&a[i]<='9')||a[i]=='_'){ } else{ y=0; break; } } } if(y==1){ cout<<"yes"; } else{ cout<<"no"; } return 0; }