摘要:
#include<iostream> #include<stdio.h> #include<cstring> using namespace std; struct ss{ int next,to; };ss data[200010]; const int inf=1e9+7; int n,q,ti 阅读全文
摘要:
1 #include<cstdio> 2 using namespace std; 3 #define MAXN 111111 4 int stack[MAXN]; 5 int l[MAXN],r[MAXN]; 6 long long a[MAXN],s[MAXN]; 7 int main(){ 8 阅读全文
摘要:
同余对于一般除法不封闭,因此有乘法逆元 1.费马小定理 a^(p-1)=1 mod p,p为素数 故a mod p的逆元为a^(p-1),快速幂即可 1 int pow( int n, int k) { 2 long long ans = 1; 3 while(k) 4 { 5 if(k&1)ans 阅读全文
摘要:
官方题解; (有时候不知怎么打不开cf,搬过来方便看) 1253A - Один подъем If we set di=bi−aidi=bi−ai, we have to check that dd has the following form: [0,0,…,0,k,k,…,k,0,0,…,0] 阅读全文