Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
97458 揭伟琦 不吉利的数 C++ Compile Error 0 MS 0 KB 642 2024-11-15 23:00:55

Tests(0/0):


Code:

static int a; public static void main(String[] args){ Scanner sc=new Scanner(System.in); while(true){ a=sc.nextInt(); int y=0; String str=String.valueOf(a); for(int i=0;i<str.length();i++){ if(str.charAt(i)=='0'){ System.out.println("Unlucky"); y=1; break; } } if(y!=1){ System.out.println(start(a)); } } } public static int start(int n){ int num=0; for(int b=1;b<=a;b++){ String str=String.valueOf(b); for(int c=0;c<str.length();c++){ if(str.charAt(c)=='0'){ num++; c=str.length(); } } } return n-num; }


Run Info:

Main.cc:2:2: error: expected unqualified-id before 'public'
  public static void main(String[] args){
  ^
Main.cc:1:13: warning: 'a' defined but not used [-Wunused-variable]
  static int a;
             ^