題目: 明明愛數數
import java.util.Scanner;
public class Counting{
public static Scanner sc = new Scanner(System.in);
public static void main(String args[]){
while(sc.hasNext()){
int n = sc.nextInt();
int m = sc.nextInt();
int total = n;
int i,j=1;
for(i = n+1; total <= m; i++){
total += i;
j++;
}
System.out.println( j );
}
}
}
沒有留言:
張貼留言