#28967: WA 您的答案為: 21691755 ...略 正確答案為: 202


s21113128@stu.edu.tw (嘎嘎猛)


 import java.util.Scanner;


public class stage4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextInt()){
            boolean ab = false;
            int sum = 0;
            int count = 0;
            int n = sc.nextInt();
            int m = sc.nextInt();

            while(ab==false){
                    int i = 1;
                    sum += n+i;
                    i++;
                    count++;
                    if(sum>m) ab = true;
            }  
            System.out.println(count);
        }
    }
}
#28968: Re:WA 您的答案為: 21691755 ...略 正確答案為: 202


cges30901 (cges30901)


 

            while(ab==false){
                    int i = 1;
                   


1. int i = 1放錯地方了

2. 從n開始數,不是從n+1開始

#28970: Re:WA 您的答案為: 21691755 ...略 正確答案為: 202


s21113128@stu.edu.tw (嘎嘎猛)


 

            while(ab==false){
                    int i = 1;
                   


1. int i = 1放錯地方了

2. 從n開始數,不是從n+1開始


感謝 過了