摘要: 【题解】 先预处理出模N意义下的前缀和sum[i]。 1.如果sum[i]=0,那么1~i的数之和就是N的倍数 2.sum[i]%N总共有0~N-1这N种情况;根据1,如果sum[i]为0则必定有解;如果不存在sum[i]=0,那么根据抽屉原理,有N个前缀和,N-1种情况,那么一定存在sum[i]= 阅读全文
posted @ 2017-10-26 16:48 Driver_Lao 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 【题意概述】 给出一个x(x≤10^6),求出任意一个满足十进制中包含0~9十个数字并且是x的倍数的数 【题解】 思维题。。。 我们可以强制让这个数的开头是1234567890,这个数可以表示为1234567890000000+a 那么当这个数为x的倍数时,这个数为1234567890000000+ 阅读全文
posted @ 2017-10-26 16:13 Driver_Lao 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 洛谷3366 1 #include<cstdio> 2 #include<algorithm> 3 using namespace std; 4 const int maxn=5010,maxm=200010; 5 int n,m,fa[maxn],tot=0,ans=0; 6 struct edg 阅读全文
posted @ 2017-10-26 10:41 Driver_Lao 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 二分+特殊姿势的check:二分最小代价P,把边权小于等于P的边设为0,其他的设为1,跑一遍最短路,判断dis[n]是否大于K 1 #include<cstdio> 2 #include<algorithm> 3 #include<cstring> 4 #include<queue> 5 using 阅读全文
posted @ 2017-10-26 08:16 Driver_Lao 阅读(167) 评论(0) 推荐(0) 编辑