Tag: problem: (E) Okabe and El Psy Kongroo

Codeforces Round #420 (Div. 2), problem: (E) Okabe and El Psy Kongroo Solution In C/C++

#include <stdio.h> #define m 1000000007u typedef long long unsigned llu; typedef unsigned u; u M; u X,Y,*A,*B,*C; int main() { u q,n,e,i,j,k; for(n=-1;++n<16;) { for(i=-1;++i<=n;) for(j=-1;++j<=n;) M=(i<j?j-i:i-j)<2; for(e=0;++e<64;) { for(i=-1;++i<=n;) for(j=-1;++j<=n;) for(k=-1;++k<=n;) M= ( M+ M* (llu)M )%m; } } llu x,y,z;*(A=X)=1;B=Y; for(scanf(“%u%I64u”,&q,&z);q–;) { scanf(“%I64u%I64u%u”,&x,&y,&n); if(y>z)y=z; for(x=y-x,e=0;x;x>>=1,++e)if(x&1) { for(i=-1;++i<=n;) for(B=0,j=-1;++j<=n;) B=(B+M*(llu)A)%m; C=A;A=B;B=C; } for(i=n;++i<16;)A=0; } printf(“%un”,*A); return 0; }

Want to stay up to date with the latest news?

We would love to hear from you! Please fill in your details and we will stay in touch. It's that simple!