随笔分类 - 模板√
摘要:int quick(int a,int b,int c)//¿ìËÙÃÝ a^b mod c { long long ans=1; while(b) { if(b&1)ans=ans*a%c; a=a*a%c; b>>=1; } return ans; } 原理: n^k = (n ^ (k /2)
阅读全文
摘要:有负环也资磁√ #include<cstdio> #include<iostream> #include<cstring> #include<algorithm> #define inf 233333333333 using namespace std; int cost[1000][1000];/
阅读全文
摘要://spfa算的是从x到其他所有点的最短路 QAQ是一种求单源最短路的算法,判断负环非常资磁 用到的变量: n:点的个数从1到n标号 /* queue<int>q :一个队列,用stl或者手打,priority_queue也很资磁啊 head:队列头 tail:队列尾 bool vis[Maxm]:
阅读全文
摘要:#include <cstdio> using namespace std; long long gcd(long long a, long long b) { // (a, b) return b ? gcd(b, a % b) : a; } long long exGcd(long long a
阅读全文
摘要:#include <cmath> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> using namespace std; const int Bit = 1000000000; const
阅读全文
摘要:1 int find(int x) 2 { 3 if(father[x]!=x)father[x]=find(father[x]); 4 return father[x]; 5 } 6 void u(int r1,int r2) 7 { 8 father[r2]=r1; 9 } 高精度系列 1 vo
阅读全文

浙公网安备 33010602011771号