Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
44121 | lnx | 合法C标识符 | C++ | Accepted | 0 MS | 244 KB | 404 | 2024-03-29 14:54:44 |
#include<bits/stdc++.h> using namespace std; int main() { char ch[20]; cin>>ch; for(int i=0;i<strlen(ch);i++) { int a=(int)ch[i]; if(i==0) { if(!((a>64&&a<91)||(a>96&&a<123))) { cout<<"no"; return 0; } } else { if(!((a>47&&a<58)||(a>64&&a<91)||a==95||(a>96&&a<123))) { cout<<"no"; return 0; } } } cout<<"yes"; return 0; }