Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
3659 | 吴奕希 | 合法的标识符 | C++ | Accepted | 0 MS | 256 KB | 814 | 2024-06-22 16:58:22 |
#include <iostream> #include <string> using namespace std; bool isVIf(string str){ if(str[0] >= '0' && str[0] <= '9'){ return false; } for(int i = 0; i < str.size(); i++){ if ((str[i] >= 'a' && str[i] <= 'z') || (str[i] >= 'A' && str[i] <= 'Z')) { continue; } else if (str[i] >= '0' && str[i] <= '9') { continue; } else if (str[i] == '_') { continue; } else { return false; } } return true; } int main() { string input; cin>>input; if (isVIf(input)) { cout << "yes" << endl; } else { cout << "no" << endl; } return 0; }