Question Link
A + B
Time Limit: 2000/1000 ms (Java/others) memory limit: 128000/64000 KB (Java/Others)Problem descriptioninputoutputsample Input
23 11 2 33 101 2 3
Sample output
660074
/*************************************** * *********************************> File Name: 1007.cpp> author: stomach_ache> mail: [email protected]> created time: Monday August 11, 2014> propose: **************************************** * ******************************/# include <cstdio> /* let's fight !!! */Typedef long ll; const ll mod = (LL) 1e10 + 7; ll MUL (ll a, LL B) {ll res = 0; while (B) {If (B & 1) if (RES + = A)> = mod) RES-= MOD; A <= 1; if (a> = mod) a-= MOD; B >>= 1;} return res;} ll mod_pow (ll a, LL B) {ll res = 1; while (B) {If (B & 1) RES = MUL (Res, a); A = MUL (a, a); B >>= 1;} return res ;} int main (void) {int t; scanf ("% d", & T); While (t --) {ll N, K, ANS = 0, x; scanf ("% LLD", & N, & K); K % = 9560995488ll; For (INT I = 0; I <n; I ++) {scanf ("% LLD", & X); ans + = mod_pow (X % mod + mod) % mod, k); If (ANS> = mod) ans-= MOD;} printf ("% LLD \ n", ANS);} return 0 ;}