AcWing
..........
qq_45693271
这个作者很懒,什么都没留下…
展开
-
AcWing 91. 最短Hamilton路径
#include <iostream>#include <cstring>#include <algorithm>using namespace std;int f[1<<20][20], weigh[20][20];int i, k, j, n;int main(){ memset(f, 0x3f, sizeof(f));//将此二维数组全部赋值为正无穷 cin >> n; for (i=0; i&l.原创 2021-03-24 19:54:20 · 36 阅读 · 0 评论 -
Acwing 90. 64位整数乘法 快速幂取模的变形
#include <iostream>using namespace std;typedef unsigned long long ull;ull q(ull a, ull b, ull p){ ull res = 0 ; while(b) { if (b & 1) res = (res + a) %p; a = a * 2 % p; b >>= 1; } return res;}int main(){ ull a, b, p.原创 2021-03-17 21:26:33 · 74 阅读 · 0 评论 -
Acwing 89 a^b 位运算 快速幂
快速模取幂#include <iostream>using namespace std;int main(){ int a, b, p; cin >> a >> b >> p; int res = 1 % p; while (b) { if (b & 1) res = (long long)res * a % p; a = (long long)a .原创 2021-03-14 17:34:24 · 68 阅读 · 0 评论 -
AcWing104.货仓选址
AcWing104.货仓选址题目代码解释说明题目代码#include <iostream>#include <algorithm>#include <math.h>using namespace std;int main(){ int N=100010;//N为自己设定的数组的大小,a[N]为设立的输入数组 int n,a[N],i,c,s;//注意此处的a[N],不能为a[n],我就犯了这种低级错误,找了好久才发现,哈哈哈哈 s原创 2021-02-01 23:30:40 · 149 阅读 · 0 评论