蓝桥杯JAVA数列求和
程序员文章站
2022-06-13 10:30:03
...
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a = 1,b = 1,c = 1;
for (int i = 4; i <= n; i++) {
int temp = (a + b + c)%100000;//为了防止超过最大整数,可以对100000取余
a = b%100000;
b = c%100000;
c = t;
}
System.out.println(c);
}
}