Related
In following contests:
本题给出了一个递推序列的递推式:
有一个整数序列 x0,x1,x2,…,其中 x0=1modM, x1=1modM,且对于所有 i≥0,满足 xi+2=(A⋅xi+1+B⋅xi)modM。
给定系数 A,B 和模数 M,以及若干询问,请你对每个询问输出对应位置的序列值。
保证 1≤A,B,M≤108,询问次数 q 满足 1≤q≤50000,每次询问的下标 k 满足 1≤k≤50000。
第一行包含三个整数 A,B,M。
In following contests:
Scan the QR code below with WeChat to sign in
First-time scan will create your account automatically
请使用微信扫描下方二维码完成注册