摘要:
扩展欧几里得求逆元 void exgcd ( int a , int b ) { if ( b == 0 ) { x = 1; y = 0; return ; } exgcd ( b , a % b ); int xx , yy; xx = y; yy = x - (a/b) * y; x = xx 阅读全文
摘要:
把字符串翻转之后处理会更加方便 #include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define rep(i,a,b) for(ll i=(a);i<=(b);i++) #define dec(i 阅读全文
摘要:
https://codeforces.com/problemset/problem/1619/E 用栈处理 #include <bits/stdc++.h> #define ll long long #define ull unsigned long long #define rep(i,a,b) 阅读全文
摘要:
E 分别算横坐标和纵坐标 #include<bits/stdc++.h> using namespace std; const int N=1e6+5; typedef long long LL; const LL mod=998244353; LL dx[N][2],dy[N][2]; LL f[ 阅读全文
摘要:
ABCDE略 F 容易想到建图,我卡在如果把所有属于同一集合的边都加在图上,会让问题变复杂,当两个点属于同一集合的时候就不用在把这个边加上去了。 #include <bits/stdc++.h> #define ll long long #define ull unsigned long long 阅读全文