import java.util.Scanner;
public class Main{
public static void main(String[]args){
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
int b=sc.nextInt();
int c=sc.nextInt();
int sum=0;
while(a<=b) {
sum += a;
a += c;
}
System.out.println(sum);
}
}
ZZULIOJ 1006: 求等差数列的和 JAVA
于 2023-06-29 09:51:41 首次发布