E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
ans
NOIP2010普及组 三国游戏 -SilverN
1#include2#include3#include4#include5usingnamespacestd;6intd[510][510];7intn;8intfst,snd,
ans
;9intmain
weixin_30585437
·
2020-09-14 01:27
[luoguP2672] 推销员(贪心 + 树状数组 + 优先队列)
(x):(y))intn,last,now,
ans
,M[N];std::priority_queueq
weixin_30433075
·
2020-09-14 01:54
[莫比乌斯反演] BZOJ 4804 欧拉心算
手推一推就知道答案是
Ans
=∑D=1n⌊nD⌋⌊nD⌋∑d|Dμ(d)∗ϕ(Dd)后面那个f(n)=∑d|nμ(d)∗ϕ(nd)显然是个积性函数而且有μ的存在求起来很轻易啊直接一个线性筛预处理复杂度O(
里阿奴摩西
·
2020-09-14 01:12
莫比乌斯反演&杜教筛
【NOIP2012 提高组 day1】国王游戏
题目题解–这是一道深深埋藏起来的贪心题对于如下队列:a0b0a1b1a2b2
ans
1=max(a0/b1,a0*a1/b2)然而队列也可能是这样的:a0b0a2b2a1b1
ans
2=max(a0/b2,
Stupid_Computer
·
2020-09-14 00:41
贪心
高精度
2126. OIBH杯第三次模拟赛(普及组)Problem 3 : maxsum 最大约数和
样例输入11样例输出9数据范围限制对于30%的数据,S#include#include#pragmaG++optimize(2)usingnamespacestd;intn,
ans
=0;intf[1010
qq_40812897
·
2020-09-14 00:07
【luogu 1199】NOIP普及组 2010 三国游戏 {贪心+博弈论}
代码#include#includeusingnamespacestd;intn,a[5001][5001],maxx,maa,
ans
;intmain(){scanf("%d",&n);for(inti
心有猛虎|细嗅蔷薇
·
2020-09-14 00:03
博弈论(NIM博弈/SG函数)
贪心算法
【NOIP2010】【Luogu1199】三国游戏
#include#definemaxn510usingnamespacestd;inta[maxn][maxn],
ans
;intmain(){intn;cin>>n;for(inti=1;i>a[i][
小哈里
·
2020-09-14 00:18
算法
Bzoj2839:集合计数:组合数学+容斥
个作为交集中的数,是C(n,k),这样的集合共有2^(2^(n-k))-1个2^(n-k)是包含选定的k个数的可选集合的数量,选取方案有2^(2^(n-k))-1个(不能有空集否则无法保证k个元素)所以
ans
TheWolfWhistlingSong
·
2020-09-14 00:18
OI
组合数学
2016.08.19上午【初中部 NOIP普及组 】模拟赛题解
首先我们最容易想到的就是枚举[i,j]在不在园内,但效率只有O(n^2),25000/25000已经时超了,因此我们要运用一种神奇的定律:勾股定理;我们只要枚举i然后求出j:然后大家应该明白了吧;每次
ans
peter_pascal
·
2020-09-14 00:28
比赛题解
2017.5.17 COCI2014/2015 Contest#5
【代码】#includeusingnamespacestd;#defineoo1000000007#defineM1005intn,m,lim,
ans
=-1,now=1;charmp[M][M];intto
nanhan27
·
2020-09-14 00:21
poj1018 Communication System
constintinf=0x3f3f3f3f;intdp[105][1200];intmain(){intt,n,r,band,cost;scanf("%d",&t);for(inti=0;ians)
ans
iboxty
·
2020-09-14 00:01
Learning:数论(三) 欧拉函数
代码如下:intn,m,cnt,
ans
,x,y,phi[N],prm[N],vis[N];voidinit(){phi[1]=1;for(i
ezoiHQM
·
2020-09-14 00:09
欧拉函数
Learning
数论
数学
欧拉函数
一道普通的hash
4#includeusingnamespacestd;constintMod=3000017;intn,x[100010],y[100010],h[Mod+10],
ans
=0,edge=0,num[Mod
chenkainan1023
·
2020-09-14 00:22
P4135 作诗——分块
代码如下:#include#include#include#includeusingnamespacestd;intconstmaxn=1e5+5;intn,c,m,mod,a[maxn],
ans
aodan5477
·
2020-09-14 00:39
Noip 2012 提高组 国王游戏
那么没有交换之前
ans
1=max(A/b,A*a/y),交换后
ans
2=max(A/y
YKLCY_1334
·
2020-09-14 00:56
NOIP
【SSL_1138】序列
我们先预处理出每个数字的因数(除了他本身),然后动态转移就好了(我用了滚动数组所以动态转移方程不太好理解,还望见谅)#include#include#includeusingnamespacestd;longlongn,k,
ans
SSL_GYX
·
2020-09-14 00:49
DP
[BZOJ 4804]欧拉心算:莫比乌斯反演
点击这里查看原题经过一系列反演,得到
ans
(n)=∑T=1n⌊nT⌋∗⌊nT⌋∗∑i|Tφ(i)∗μ(Ti)(看不懂的建议先去做BZOJ2820)于是接下来就是要对∑i|Tφ(i)∗μ(Ti)求前缀和,
BrooksBUAA
·
2020-09-14 00:18
BZOJ
莫比乌斯反演
【纪中20200613】圆圈
输入输入有多组测试数据,每组测试数据一行输入一个整数r(r#include#include#includeusingnamespacestd;longlongn,
ans
,t;intmain(){cin>
SSL_GYX
·
2020-09-14 00:46
纪中
P1080 国王游戏
blog.csdn.net/Rlt1296/article/details/52793197#include#include#include#includeusingnamespacestd;intn,pai[10005],
ans
Pandauncle
·
2020-09-14 00:12
ACM算法
2016.08.19 初中部 NOIP普及组 模拟赛
总结这次比赛发挥得不错(主要是题目水)T1:水题,先算两条直径和中间的点,是4r+1然后算四分之一圆里的点,公式sqrt(r^2-i^2)(1
ans
就可以了,注意判断整除的情况。
Mike_Eason
·
2020-09-14 00:11
[题解] NOIP2012 国王游戏(数论+高精)
题目分析:我们对于国王身后的两个点来分析队列可能是这样的:*LeftRightking:a0a0b0b0p1a1a1b1b1p2a2a2b2b2那么我们计算可得
ans
1
ans
1=max(a0b1,a0∗
Chlience
·
2020-09-14 00:02
国王游戏
#include#include#include#include#includeusingnamespacestd;intn,
ans
,mx;structpe{intl,r,s;}a[1005];boolcmp
ivy-uu
·
2020-09-14 00:50
贪心
贪心
0701 国王游戏
0701国王游戏按照x*y从小到大排序,注意大数,这里提供python代码importfunctoolsclassmyclass:a,b=0,0defcmp1(x,y):returnx.a*x.bans:
ans
海边拾贝的言
·
2020-09-14 00:38
贪心
Python
noip2012国王游戏
#include#include#include#include#includeusingnamespacestd;constintmaxn=1010;intn,now[maxn],
ans
[maxn],
renxinyu2002
·
2020-09-14 00:26
noip冲刺复习
贪心专题
高精度
【NOIP2012】 国王游戏
#defineMAXN1010#defineMAXL10000structinfo{intl,r;}a[MAXN];inti,n;structINT{intlen;intnum[MAXL];}sum,
ans
even_bao
·
2020-09-14 00:24
贪心
高精度计算
国王游戏
处理时我们可以有两人的价值得
ans
1
ans
1=max(a0b1,a0∗a1b2)max(a0b
布拉克王国国王黑叔叔
·
2020-09-14 00:16
排序
T145192 【2020.8.23NOIP模拟赛】最优路线【DP&Floyd】
ansansansi,j作为转移变量,表示iii号点到jjj号点的min(最大路径长度×路径上的最大点权)\min(最大路径长度\times路径上的最大点权)min(最大路径长度×路径上的最大点权)可得动态转移方程:
ans
Jackma_mayichao
·
2020-09-14 00:36
题解(较高质量)
dp
图论
2020年9月12日普及组 T1 字符串【模拟】
代码:#include#include#include#includeusingnamespacestd;longlongvis[100010],
ans
;strings;intmain(){cin>>s
Jackma_mayichao
·
2020-09-14 00:03
模拟
题解
打印二叉树的方法
因为还需要自己判断//层序遍历分组输出vector>levelGroup(TreeNode*root){queueque;que.push(root);vector>
ans
;while(!
hhmy77
·
2020-09-13 22:53
数据结构
NCD 2019 (AK)
A.Hasanthelazyjudge#includeusingnamespacestd;inlineintread(){intx=0;boolf=0;charch=getchar();while(ch=1){
ans
weixin_30377461
·
2020-09-13 20:53
10.22 kmp练习
233333【hdu1711】NumberSequence#include#include#includeusingnamespacestd;intne[10010],n,m,t,
ans
;inta[10000
weixin_30263073
·
2020-09-13 20:49
求原根模版
includeusingnamespacestd;typedeflonglongLL;intp[100000],c;LLpow_mod(LLa,LLx,LLm){LLans=1;while(x){if(x&1)
ans
芋智波佐助
·
2020-09-13 19:30
模版
浅析中国剩余定理(CRT)
#include#include#includeusingnamespacestd;inta[1007],m[1007];intn,
ans
,M=1;intexgcd(
C20201018
·
2020-09-13 19:44
数论
C++数论专栏
B. Buildings(手镯问题)
in.txt","r",stdin);llm,n,c;while(cin>>n>>m>>c){llnum=quickmod(c,n*n,mod);llans=0;f(i,1,m){lld=gcd(i,m);
ans
DQYZhwk
·
2020-09-13 19:10
Codeforces
pupil
基础数论
Educational Codeforces Round 74 F. The Maximum Subtree (换根dp)
(n#definelllonglongusingnamespacestd;constintmaxn=3e5+50;vectorg[maxn];intsz[maxn],dp[maxn][2],
ans
[maxn
_ 泛白
·
2020-09-13 19:05
dp
题解 CF1200C Round Corridor【gcd】
ausingnamespacestd;#definelllonglongllgetint(){llans=0,f=1;charc=getchar();while(c>'9'||c='0'&&c<='9'){
ans
破壁人五号
·
2020-09-13 19:11
题解
#
来源-codeforces
#
数学-数论
ACM-ICPC 2018 南京赛区网络预赛题解
B.Thewritingonthewall我们可以一列一列的看,如果该列没有黑点的话,那么
ans
+=(1+n)*n/2,如果有黑点的话,可以用set维护被黑点分开的区间,那么再计算这个区间长度就能得到这个区间的贡献了
大学要有梦想
·
2020-09-13 19:15
比赛总结
Exponial Kattis - exponial(欧拉降幂)
longlong)0x3f3f3f3flonglongtmp;longlongeuler(longlongn)//求一个数的欧拉函数{longlongans=n;for(longlongi=2;i*i1)
ans
.帅帅.
·
2020-09-13 19:07
欧拉降幂
Exponial
leetcode—数字反转
System.out.println(reverse(-1234567899)+"");//}publicstaticintreverse(intx){Stringans_s="";intend=0;if(x=end;i--){
ans
_s
lc_2013
·
2020-09-13 19:13
算法
数字反转
Windows下比较两个文件的不同(命令行操作/相关软件)
假设现有两个测试文件1381.in和1381.
ans
,其中1381.in是程序输入文件,1381.
ans
程序输入对应的正确答案的输出。假设我们将自己编写的程序重定向输出到1381.out文件。
LanceLeng
·
2020-09-13 19:12
笔记
BZOJ4331: JSOI2012 越狱老虎桥
删去最小的一条边使得图不连通,这条被删去的边权的最大值先缩环,因为环上的边不能砍剩下的边按边权从小到大排序从最小的边开始每条边考虑,如果他和之前边的并集在一条链上,那么一定有一种加边方案使得他们都在环上,这时他们都不能砍,所以
ans
L_0_Forever_LF
·
2020-09-13 18:30
BZOJ
不知道该分哪的题
tarjan
中国剩余定理+扩展
那么
ans
=sigmaai*Mi*Rimod(M)为啥呢
kamisamaxmd
·
2020-09-13 18:57
总结
纯属娱乐
classNode{public:intpara;intexp;Node*next;};boolcmp(Nodex,Nodey){returnx.paranext;head2=head2->next;
ans
木土的H
·
2020-09-13 18:06
基础
娱乐
BZOJ 4327: JSOI2012 玄武密码
2.查子串查询时跳parent,记录最大
ans
.3.查次数LCT维护right数组4.查不同的串的数目在建树时维护,一个点对答案的贡献为this->max_len-this->parent->max_len
LZJ209
·
2020-09-13 17:32
BZOJ
后缀自动机
【BZOJ1023】仙人掌图(仙人掌,动态规划)
首先和普通的仙人掌\(dp\)是一样的,对于没有问题的圆圆边,直接做最长链的转移(同时更新\(
ans
\))然后对于一个环,把它拎出来单独考虑首先要对于这个环,计算能够贡献的答案,然后再用环上的值更新环的最顶点先考虑
weixin_30800987
·
2020-09-13 16:38
数学与树学(娱乐向)
Deepinc:$
ans
=\frac{\sum\limits_{i=1}^{m}(i^k-(i-1)^k)*w[i]}{m^k}*(n-k+1)$DuanYue:$g[x]=\s
weixin_30538029
·
2020-09-13 16:56
数据结构与算法
BZOJ 1023: [SHOI2008]cactus仙人掌图
f[x]表示以x为根的节点的最大深度,tarjan的目的就是求出桥,用来更新每个环的父亲的f数组与整个的
ans
。求出环后因为可以从环上的任意一点更新环的父亲,所以要用双端队列优化的dp来处理。
妖怪吧
·
2020-09-13 16:31
图论--仙人掌
bzoj 1023: [SHOI2008]cactus仙人掌图
直径显然存在唯一最高点,所以
ans
=Max{F1,F2,F3,
fyc_kabuto
·
2020-09-13 16:39
仙人掌图
拼多多9.1提前批笔试
题目:http://mrw.so/6tsmXx1.打印米字矩阵3.带负数的01背包(学到了,把负体积先装进去,相当于总体积先扩大,总收益起点为
ans
,遇到负体积的物品相当于取出,收益增加它的相反数,如收益
qq_33761777
·
2020-09-13 16:57
百度9.3提前批笔试
friendbooloperatorusingnamespacestd;structnode{intp,w,v;friendbooloperatorb.v;}};vectorG;intmain(){intp,w,v;intn,m,k,i,j,
ans
qq_33761777
·
2020-09-13 16:57
上一页
53
54
55
56
57
58
59
60
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他