可AK场,题目非常基础,可惜比赛时太困,没来得及AK...由于一开始选了C++14,导致写B题时用gets函数一直编译报错,用getline就一直T到飞...赛后改C++11就过了,最终没来得及看非常easy的J题QAQ~
A.dreamstart的催促:签道题。
1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long LL; 4 const LL mod=10000019; 5 const int maxn=1e5+5; 6 int n;LL ans,x; 7 LL quick_mod(LL a,LL b){ 8 LL res=1LL; 9 while(b){ 10 if(b&1)res=res*a%mod; 11 a=a*a%mod; 12 b>>=1; 13 } 14 return res; 15 } 16 int main(){ 17 while(~scanf("%d",&n)){ 18 ans=0; 19 for(int i=1;i<=n;++i)scanf("%lld",&x),ans=(ans+quick_mod(x,i))%mod; 20 printf("%lld\n",ans); 21 } 22 return 0; 23 }