编程介的小学生 2017-10-31 04:44 采纳率: 20.5%
浏览 874
已采纳

Disgruntled Judge

Problem Description
Once upon a time, there was an nwerc judge with a tendency to create slightly too hard problems. As a result, his problems were never solved. As you can image, this made our judge somewhat frustrated. This year, this frustration has culminated, and he has decided that rather than spending a lot of time constructing a well-crafted problem, he will simply write some insanely hard problem statement and just generate some random input and output files. After all, why bother having proper test data if nobody is going to try the problem anyway?

Thus, the judge generates a testcase by simply letting the input be a random number, and letting the output be another random number. Formally, to generate the data set with T test cases, the judge generates 2T random numbers x1, ..., x2T between 0 and 10000, and then writes T, followed by the sequence x1, x3, x5, ..., x2T-1 to the input file, and the sequence x2, x4, x6, ..., x2T to the output file.

The random number generator the judge uses is quite simple. He picks three numbers x1, a, and b between 0 and 10000 (inclusive), and then for i from 2 to 2T lets xi = (a · xi-1 + b) mod 10001.

You may have thought that such a poorly designed problem would not be used in a contest of such high standards as nwerc. Well, you were wrong.

Input
On the first line one positive number: the number of testcases, at most 100. After that per testcase:

  • One line containing an integer n (0 ≤ n ≤ 10000): an input testcase.

The input file is guaranteed to be generated by the process described above.

Output
Per testcase:

  • One line with an integer giving the answer for the testcase.

If there is more than one output file consistent with the input file, any one of these is acceptable.

Sample Input
3
17
822
3014

Sample Output
9727
1918
4110

  • 写回答

1条回答 默认 最新

  • threenewbee 2017-11-24 15:05
    关注
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题