![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
acm
文章平均质量分 51
_lanChe
这个作者很懒,什么都没留下…
展开
-
icpc2020济南站
A Matrix Equation利用列相互独立,将题目公式化简即可#include <cstdio>#include <algorithm>#include <cstring>#include <cmath>#include <iostream>#include <vector>#include <map>#include <queue>#include <bitset>#原创 2021-03-03 13:27:10 · 325 阅读 · 0 评论 -
The 15th Heilongjiang Provincial Collegiate Programming Contest--队内训练
题目ABCDEFGHIJKLSolved♠\spadesuit♠⊘\oslash⊘♠\spadesuit♠♠\spadesuit♠∙\bullet∙♠\spadesuit♠∙\bullet∙♠\spadesuit♠ ♠\spadesuit♠比赛时通过;∙\bullet∙:赛后通过;⊘\oslash⊘ :比赛时尝试了未通过;∘\circ∘:比赛时未尝试A. August开场签到题,题意就是求题目中的图形面积,一眼看下去,直觉爱心的下...原创 2020-12-02 23:21:08 · 737 阅读 · 0 评论 -
2018-2019 ACM-ICPC, Asia Jiaozuo Regional Contest--队内训练
题目ABCDEFGHIJKLSolved♠\spadesuit♠∙\bullet∙♠\spadesuit♠♠\spadesuit♠∙\bullet∙∙\bullet∙♠\spadesuit♠ ♠\spadesuit♠比赛时通过;∙\bullet∙:赛后通过;⊘\oslash⊘ :比赛时尝试了未通过;∘\circ∘:比赛时未尝试A.Xu Xiake in Henan Province签到题#include<bits/stdc...原创 2020-12-01 16:13:51 · 161 阅读 · 0 评论 -
The 11th Zhejiang Provincial Collegiate Programming Contest
A.Pokemon Master传送门#include <bits/stdc++.h>using namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair<int, int> pii;template <typename T>inline void rd(T& x){ ll tmp = 1; char c = getchar(); x = 0;原创 2020-10-13 10:23:18 · 221 阅读 · 0 评论 -
队内训练(一)
Fibonacci Sum-HDU 6755传送门思路对着式子瞎弄一顿,最后把通项公式套进去发现ans=∑i=0n15×[(1+52)ic−(1−52)ic]k=15∑i=0n([1+52]ic+[−(1−52)ic])kans=\sum_{i=0}^{n}\frac{1}{\sqrt{5}}×[(\frac{1+\sqrt{5}}{2})^{ic}-(\frac{1-\sqrt{5}}{2})^{ic}]^k\\=\frac{1}{\sqrt{5}}\sum_{i=0}^{n}([\frac{1+原创 2020-08-17 13:45:15 · 195 阅读 · 0 评论 -
队内训练(三)
Road To The 3rd Building - HDU_6827传送门思路先进行一遍处理前nnn项和 sum(n)sum(n)sum(n)对每个例子全部写一遍发现,每一个数都有特定的出现次数,在一段n/2n/2n/2的权中,第一个只贡献一次,第二次贡献两次,依此类推…所以可得每次的cnt[i]=cnt[i−1]+(sum[n−i+1]−sum[i−1])cnt[i]=cnt[i-1]+(sum[n-i+1]-sum[i-1])cnt[i]=cnt[i−1]+(sum[n−i+1]−sum[原创 2020-08-15 17:18:53 · 93 阅读 · 0 评论 -
杭电多校部分习题
Tokitsukaze and Rescuehdu6797_传送门思路对最多5个边进行删除操作,即将边权值设置成 infinfinf即可对于每一次的删边操作,枚举每一次跑的最短路径中的 n−1n-1n−1条边最后在删了k次边后再跑一遍 dijkstradijkstradijkstra由于边比较小,直接使用邻接矩阵forforfor循环跑一遍即可,身边有人用链式向前星会莫名超时,我也不懂,8s是绰绰有余的#include <bits/stdc++.h>using namespa原创 2020-08-12 22:22:27 · 206 阅读 · 0 评论 -
无题II hdu-2236
这是一个简单的游戏,在一个n*n的矩阵中,找n个数使得这n个数都在不同的行和列里并且要求这n个数中的最大值和最小值的差值最小。这道题是道不错的二分图题首先要对答案进行二分了,这个很自然就想到了;但在后面对二分是否符合的判断思路卡住了后面才想到使用枚举从(最小值,最小值+二分的差值)枚举这个区间进行行列匹配。好题!!!详情见如下代码#include <cstdio>#include <algorithm>#include <cstring>#include原创 2020-08-04 09:19:02 · 163 阅读 · 0 评论 -
poj 2135--Farm Tour--费用流
#include <cstdio>#include <algorithm>#include <cstring>#include <vector> #include <queue>using namespace std;const int N=1e3+10;const int inf=0x3f3f3f3f;struct Edge{ int from,to,cap,flow,w;};vector<Edge>ed原创 2020-08-01 13:38:45 · 138 阅读 · 0 评论 -
Drainage Ditches --网络流
① dinic#include <bits/stdc++.h>using namespace std;const int N=2e2+10;const int M=4e2+10;const int inf=0x3f3f3f3f;int head[N],cnt;struct edge{ int next,to,cap,flow;}e[M];void add(int u,int v,int cap,int flow){ e[cnt].to=v; e[cnt].next=he原创 2020-08-01 10:03:34 · 78 阅读 · 0 评论 -
Game of Hyper Knights ---LightOJ - 1315
这道题有两个坑:①棋子的移动方向,不存在返回走的路,所以经过的点不需要进行vis标记②这个棋盘只有上界和左界,题目只是给出点x,y的坐标范围,没给出棋盘范围 找bug找吐了,所以按照棋子从(500,500)往右上方走,右界应是750,从(500,500)往左下方走,下界是750数组开大一点还是有好处的其他的算是普通sg函数的递归写法。sg函数的递归写法需要注意一个点int getSG(int x,int y){ if(sg[x][y]!=-1) return sg[x][y]; bool vi原创 2020-07-29 18:53:27 · 153 阅读 · 0 评论 -
hznu-1892-永远的17岁
#include <bits/stdc++.h>using namespace std;const int N = 1e5 + 10;int main() { int T; scanf("%d", &T); while (T--) { int n; scanf("%d", &n); if (n < 15) puts("-1"); else printf("%d\n", n - 7); } return 0;}原创 2020-06-28 10:01:19 · 1095 阅读 · 0 评论 -
2260-与班尼特·胡迪一起成长
这题有两个坑:第一:字符串部分的数字可能多于20位,不可使用整型甚至是long long 以及 atoi() 等字符转换函数;只可以对字符串进行模拟加法;第二:要留意前导零不可省略;只看字符是数字部分!!!!剩下的看代码内的注释。#include <bits/stdc++.h>using namespace std;const int N = 1e5 + 10;char s[N];int main() { int T; scanf("%d", &T); getch原创 2020-06-28 00:09:27 · 810 阅读 · 0 评论 -
Flipping Game zoj-4114
有点难想的dp,这其中有两种方法num为两个串不同的个数dp[i][j] 为第i轮j个奇数时的结果①初始 dp[0][0]=1,然后结果 dp[k][num]/c[n][ans];但是由于取模后的精度损失,导致第一种方法没法ac;②初始dp[0][num]=1,最后输出便是dp[k][0];用第一种方法wa哭…#include <cstdio>#include <...原创 2020-03-19 21:56:07 · 154 阅读 · 0 评论 -
Valley Numer hdu-6148
基本的数位dp模板#include <cstdio>#include <algorithm>#include <cstring>using namespace std;typedef long long ll;ll n,dp[110][10][2];ll mod=1000000007;int digit[110];char s[110];ll...原创 2020-03-10 10:45:37 · 92 阅读 · 0 评论 -
Dragon Balls hdu-3635
基础带权并查集#include <cstdio>using namespace std;const int N=1e4+10;int fa[N],num[N],cnt[N];int get(int x){ if(x==fa[x]) return x; int tmp=fa[x]; fa[x]=get(fa[x]); cnt[x]+=cnt[tmp]; retur...原创 2020-02-27 10:35:56 · 81 阅读 · 0 评论 -
The Rotation Game hdu-1667
这题的难点在于移动的表示和如何标记已经访问过的图;参考了大牛的代码:https://www.cnblogs.com/tt123/p/3411377.htmlida做法有个好处,不需要去标记图,只要不往回走就行,ida会卡住有限步数,在最优的步数情况下,同一个图并不会重复访问。这是ida相对bfs的一个很大的有点。代码如下:#include <cstdio>#includ...原创 2020-02-26 09:31:24 · 102 阅读 · 0 评论 -
DNA sequence hdu-1560
亲测回溯要用矩阵可以省很多时间;#include <cstdio>#include <algorithm>#include <cstring>using namespace std;int n;char dir[4]={'A','G','C','T'};struct str{ char s[20]; int pos; bool friend ...原创 2020-02-25 23:48:49 · 73 阅读 · 0 评论 -
Power Calculus poj-3134
ida+剪枝。较基础#include <cstdio>using namespace std;int n,val[1010];bool ida(int x,int depth){ if(x>depth) return false; if(val[x]<<(depth-x)<n) return false; if(val[x]==n){ ...原创 2020-02-25 11:33:58 · 100 阅读 · 0 评论 -
Channel Allocation poj-1129
水题,虽然归在搜索里面,其实不算搜索类,可以直接套循环过代码如下:#include <cstdio>#include <algorithm>#include <cstring>using namespace std;int n,ans;int dis[30][30];int channel[30];void dfs(int x){ int v...原创 2020-02-24 22:22:43 · 98 阅读 · 0 评论