Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
107276 陈昊然 合法的标识符 C++ Compile Error 0 MS 0 KB 339 2025-01-17 15:13:00

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; string s; int main() { cin>>s; int n=s.size(); if(s[0]>='0'&&s[i]<='9') { cout<<"no"; return 0; } for(int i=1; i<n; i++) { if(s[i]>='a'&&s[i]<='z'||s[i]>='A'&&s[i]<='Z'||s[i]>='0'&&s[i]<='9'||s[i]=='_') { cout<<"yes"; break; } } cout<<"no"; return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:7:18: error: 'i' was not declared in this scope
  if(s[0]>='0'&&s[i]<='9') {
                  ^
Main.cc:12:15: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if(s[i]>='a'&&s[i]<='z'||s[i]>='A'&&s[i]<='Z'||s[i]>='0'&&s[i]<='9'||s[i]=='_') {
               ^
Main.cc:12:59: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   if(s[i]>='a'&&s[i]<='z'||s[i]>='A'&&s[i]<='Z'||s[i]>='0'&&s[i]<='9'||s[i]=='_') {
                                                           ^