- 博客(58)
- 收藏
- 关注
原创 打开画图之后,显示“无法创建新文档”,解决方法(win10)
目录下,如果没有或者还有问题,就从其他win10的电脑上拷贝一份,复制到对应目录。在更新之后,发现画图打不开了,分享一下自己是怎么解决的。
2023-12-28 13:32:04
4693
原创 AYIT-ACM实验室发展历程
AYIT-ACM简介 ACM协会为你的梦想插上翅膀。本院ACM协会成立于2012年2008年开始小规模参加河南省竞赛2014年成功实现金牌零突破指导老师:孙高飞老师安阳工学院计算机科学与信息工程学院ACM队是一支优秀的队伍,一支充满活力与激情的队伍,它满载着光辉与荣誉。
2023-11-13 20:04:25
639
原创 数学知识:乘法逆元
例如求 a1*a2*a3*...*an/b%mod 时,除法不能同时取模(既不能同时(a%mod) / (b%mod) ),这时可以通过乘法逆元来进行转换,既,x为b的乘法逆元,因为a/b和a*x对mod取模的值一样,所以只需要计算(a%mod*x%mod)%mod即可当编号是操作后灯会亮着;令t=sqrt(n);所以ans=t*(t+1)*(2*t+1)/6%(1e9+7);显然没有很好的办法直接求答案(用__int128也能直接求或者把6拆成2*3也行,不过个人感觉乘法逆元方好点)
2022-04-16 20:58:07
331
原创 算法竞赛进阶指南:0x02递推与递归:分治:Sumdiv
题目:假设现在有两个自然数 A 和 B,S 是A^{B}的所有约数之和。请你求出 S mod 9901的值是多少。
2022-03-20 09:24:41
378
原创 算法竞赛进阶指南:0x31质数:质数的判定、质数的筛选(Eratosthenes筛法和线性筛法)、质因子分解
质数的判定质数的筛选(Eratosthenes筛法和线性筛法)质因子分解
2022-03-19 22:48:38
261
原创 算法竞赛进阶指南:0x02递推与递归:费解的开关
25 盏灯排成一个 5×5的方形。每一个灯都有一个开关,游戏者可以改变它的状态。每一步,游戏者可以改变某一个灯的状态。游戏者改变一个灯的状态会产生连锁反应:和这个灯上下左右相邻的灯也要相应地改变其状态。我们用数字 1表示一盏开着的灯,用数字 0 表示关着的灯。
2022-03-19 10:04:27
138
原创 算法竞赛进阶指南:0x01位运算:位运算操作和lowbit运算
1<<n=,n<<1=2n取出整数n在二进制表示下的第k位:(n>>k)&1取出整数n在二进制表示下的第0~k-1位(后k位):n&((1<<k)-1)把整数n在二进制表示下的第k位取反:n xor (1<<k)对整数n在二进制表示下的第k位赋值1:n|(1<<k)对整数n在二进制表示下的第k位赋值0:n&(~(1<<k))'and' 与 &'or' 或 |'n
2022-03-18 22:17:44
393
原创 算法竞赛进阶指南:0x01位运算:起床困难综合症
题目位置:https://www.acwing.com/problem/content/1000/#include<iostream>#include<string>using namespace std;const int N=1e5+10;int n,m;pair<string,int>a[N];int calc(int bit,int now){ for(int i=1;i<=n;i++) { int x=a[i].secon
2022-03-18 21:22:21
398
原创 算法竞赛进阶指南:0x01位运算:64位整数乘法(快速乘)
题目位置https://www.acwing.com/problem/content/92/#include<iostream>using namespace std;typedef long long LL;int main(){ LL a,b,p; cin>>a>>b>>p; LL ans=0; while(b) { if(b&1)ans=(ans+a)%p; a=a*2%p; b>>=1;
2022-03-18 20:09:08
261
原创 算法竞赛进阶指南:0x01位运算:a^b(快速幂)
题目位置:https://www.acwing.com/problem/content/91/#include<iostream>using namespace std;int main(){ int a,b,p; cin>>a>>b>>p; int ans=1%p; while(b) { if(b&1)ans=(long long)ans*a%p; a=(long long)a*a%p; b>>=1
2022-03-18 20:03:36
187
原创 算法竞赛进阶指南:0x01位运算:最短Hamilton路径
题目位置:https://www.acwing.com/problem/content/description/93///核心公式:f[i,j]=min(f[i][j],f[i^1<<j][k]+weight[k][j])#include<iostream>#include<cstring>using namespace std;int n;//f[i][j] 若其第i位为1,则表示第i个点已经被经过,反之未被经过 // j:目前处于点j时.
2022-03-18 19:54:26
498
原创 数学知识:快速乘
题目来源https://ac.nowcoder.com/acm/contest/996/C//求a*b%p#include<bits/stdc++.h>#define int long longusing namespace std;int a,b,p;void solve(){ int ans=0; while(b) { if(b&1)ans=(ans+a)%p; b/=2; a=a*2%p; } cout<<ans&..
2022-03-11 20:46:15
145
原创 求混合加减乘除的答案
#include<bits/stdc++.h>using namespace std;stack<int>num;stack<char>op;void eval(){ int b=num.top();num.pop(); int a=num.top();num.pop(); char c=op.top();op.pop(); int x; if(c=='+')x=a+b; else if(c=='-')x=a-b; else if(c=='*.
2022-03-10 21:46:38
151
原创 最小生成树:Prim
#include<iostream>#include<cstring>#include<algorithm>using namespace std;const int N=510,INF=0x3f3f3f3f;int n,m; // n表示点数 int g[N][N]; // 邻接矩阵,存储所有边 int dist[N]; // 存储其他点到当前最小生成树的距离 bool st[N]; // 存储每个...
2022-03-07 23:31:32
108
原创 数学知识:快速幂
求先把k换算成二进制形式,可以变成例如==这样能极大的减少时间复杂度例题:代码:#include<stdio.h>typedef long long LL;int solve(int a,int k,int p){ int ans=1; while(k) { if(k&1)//如果k的二进制的最后一位是1,进行计算 ans=(LL)ans*a%p; k>>=1;//删除k的末尾(二进制的末尾) ...
2022-02-21 16:29:53
458
原创 数学知识:求约数个数
#include<iostream>#include<algorithm>#include<unordered_map> using namespace std;typedef long long ll;const int N=1e9+7;int main(){ int n; cin>>n; unordered_map<int,int>zheng; while(n--) { int x; cin&g...
2022-02-15 17:28:49
471
原创 并查集:The Suspects(求与第n个人相关的人数)
Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 2003. To minimize transmission to others, the best strategy is to separate the suspects from others.In the Not-Spreading-Y
2022-02-15 14:36:29
95
原创 搜索:Future Vision(移动的剑)
题目链接:https://codeforces.com/gym/103488/problem/F?mobile=trueKyooma有一把剑,他喜欢使用这把剑与别人击剑。有一天,他的剑突然传送走了,于是Kyooma开始寻找他的剑。经过长途跋涉,Kyooma终于来到了一个迷宫的门口。他知道自己的剑一定在迷宫的某个地方,但他的剑可以在这个迷宫中瞬移!现在,Kyooma向你寻求帮助。请告诉他是否能找到剑,因为你可以通过你的特殊能力未来视预测在接下来的kk分钟内剑会在哪里。迷宫由n行m列的方格组..
2022-02-13 14:12:31
346
原创 贪心:区间覆盖(Source: UVa 10382)
思路:转化成一维的形式(在代码中有注释)代码:#include<iostream>#include<algorithm>#include<cmath>#include<cstring>using namespace std;const int N=15010;struct node{ double l,r; bool operator<(node t)//重载 { return l<t.l;...
2022-02-10 19:37:07
377
原创 Anigram单词
#include<bits/stdc++.h>using namespace std;const int N=1e2+10;typedef long long LL;map<string,int>zheng;map<string,int>sai;int main(){ int n; cin>>n; while(n--) { string a; cin>>a; sai[a]++; sort(a....
2022-02-08 09:22:49
787
原创 数学知识:分解质因数
#include<iostream>using namespace std;bool flag;void divide(int n){ for(int i=2;i<=n/i;i++) { if(n%i==0) { int s=0; while(n%i==0) { n/=i; s++; } if(!flag)printf("%d^%d ",i,s),flag=true; else printf("* %d^%...
2022-02-07 18:19:45
378
2
原创 数学知识:求所有约数
#include<iostream>#include<algorithm>#include<vector>using namespace std;vector<int> yue(int n){ vector<int>r; for(int i=1;i<=n/i;i++) if(n%i==0) { r.push_back(i); if(i!=n/i) r.push_back(n/i); } ...
2022-02-07 18:02:13
333
原创 Frogger(用floyd写的)
有两只青蛙和若干块石头,现在已知这些东西的坐标,两只青蛙A坐标和青蛙B坐标是第一个和第二个坐标,现在A青蛙想要到B青蛙那里去,并且A青蛙可以借助任意石头的跳跃,而从A到B有若干通路,问从A到B的所有通路上的最大边,比如有 有两条通路 1(4)5 (3)2 代表1到5之间的边为4, 5到2之间的边为3,那么该条通路跳跃范围(两块石头之间的最大距离)为 4, 另一条通路 1(6) 4(1) 2 ,该条通路的跳跃范围为6, 两条通路的跳跃范围分别是 4 ,6,我们要求的就是最小的那一个跳跃范围,即4
2022-01-22 09:07:19
87
原创 lower_bound和upper_bound
a[5]={1,2,3,4,5};lower_bound(a,a+5,3)-a;返回值是2upper_bound(a,a+5,3)-a;返回值是3
2022-01-21 09:53:53
488
原创 Tram(最短路问题)(核心用floyd写的)
输入理解:第一行的N是代表下面有N个交叉点,最后输出A到B手动更换开关最少的次数以下N行:第i行的第一个数表示第i个交叉口有ki个轨道,下面ki个数表示i能到达的轨道,ki后面的第一个数表示交叉口原来指向的轨道t(既从i到t不用换道)
2022-01-19 10:31:20
560
原创 floyd例题(求能确定几头奶牛的排名)
Farmer John is trying to rank the cows by skill level. Given a list the results ofM(1 ≤M≤ 4,500) two-cow rounds, determine the number of cows whose ranks can be precisely determined from the results. It is guaranteed that the results of the rounds will
2022-01-18 14:20:26
305
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人