为什么我在编译器上运行可以,在这里就无法通过???求大佬讲解
查看原帖
为什么我在编译器上运行可以,在这里就无法通过???求大佬讲解
783615
Qiyu111楼主2023/8/19 17:01
java
import java.util.*;
class UnhappyDeJingJing {
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int []a = new int[12];
        int sum=0;
        int mother=0;
        int count=0;
        for(int i = 0;i<12;i++){
            a[i] = sc.nextInt();
            int b = (sum+300)-a[i];
            if(b>=0 ){
                int c=b/100;
                if(c>0){
                    b = b -(100*c);
                    mother = mother +(100*c);
                }
                sum=b;
            }
            else{
                count++;
                System.out.println();
                System.out.println("-"+(i+1));
                break;
            }
        }
        if(count==0){
            sum = sum + (int)(mother*1.2);
            System.out.println();
            System.out.println(sum);
        }
    }
}

2023/8/19 17:01
加载中...