贴题:
正确答案:https://blog.csdn.net/JeCode/article/details/49954733
我的代码:
import java.util.Scanner;
/**
* 1005
* Number Sequence
*/
public class Main{
public static void main(String[] args) {
int[]a=new int[1];
a[0]=0;
a[1]=1;
a[2]=1;
Scanner sc=new Scanner(System.in);
while(sc.hasNext()){
int A=sc.nextInt();
int B=sc.nextInt();
int n=sc.nextInt();
a[n]=(A*a[n-1]+B*a[n-2])%7;
System.out.println(a[n]);
}
}
}
出现错误,在网上找了资料,但是暂时没有解决办法。