标签:for question tle term www. scan can nbsp static
输入包括5个整数:a0、a1、p、q、k。
第k个数a(k)对10000的模。
链接:https://www.nowcoder.com/questionTerminal/d0e751eac618463bb6ac447369e4aa25 来源:牛客网 import java.util.*; public class Main { public static void main(String[] args) { Scanner reader = new Scanner(System.in); while (reader.hasNext()) { int a0 = reader.nextInt(); int a1 = reader.nextInt(); int p = reader.nextInt(); int q = reader.nextInt(); int k = reader.nextInt(); long[] a = {a0, a1}; for (int i = 2; i <= k; ++i) { long tmp = p*a[1]%10000 + q*a[0]%10000; a[0] = a[1]; a[1] = tmp; } System.out.println(a[1]%10000); } } }
标签:for question tle term www. scan can nbsp static
原文地址:https://www.cnblogs.com/JAYPARK/p/10105495.html