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
#Codeforces
codeforces
xxx d
因为要早睡所以赛后做这个题挺有意思nlgn的算法boolv[2111111];intpre[2111111];inta[222222];intn;intmain(){scanf("%d",&n);for(inti=0;i
ACpac
·
2020-09-12 12:40
codeforces
俄罗斯季度决赛题目sequence解答
原题大意如下:用两种操作产生数字序列:加倍和数字排序。数字排序就是升序方式排列数字,如数值6532,排列后的结果是2356。序列都是从1开始,序列前15个数值时124816234629581162234462895781156。请编程算出第n个序列中的数值是什么。1intmain(){inti,j,k,n,c,tmp,flag,bits,count,nn;intnum[20]={0,1,0};in
liyinchen808
·
2020-09-12 12:05
算法
解题报告
codeforces
242B
原题目链接如下:http://
codeforces
.com/problemset/problem/242/B解这小道题目让我大费周折。主要原因是轻视了。人一轻敌,思维就不缜密。
liyinchen808
·
2020-09-12 12:04
算法
codeforces
上解题感受
这两天找个到了个程序比赛的网站:www.
codeforces
.com该网站最大的好处是,可以看大家的源代码,这对个人的进步很重要。
liyinchen808
·
2020-09-12 12:04
感悟
解题报告
codeforces
242A
原题链接如下:http://www.
codeforces
.com/problemset/problem/242/A这题比较简单,但是这题给我个启示:不要时时苛求算法,有时性能稍逊一点,方法则简单很多,更容易理解
liyinchen808
·
2020-09-12 12:04
算法
Codeforces
1114C
Codeforces
1114C题目1114C题意求bbb进制下的n!n!n!末尾有多少000分析首先要知道对于十进制下n!n!n!
strategist_614
·
2020-09-12 11:02
【
Codeforces
1114 F. Please, another Queries on Array?】 线段树维护区间乘积 区间欧拉函数
Codeforces
1114F题意维护区间乘求区间乘积的欧拉函数ϕ(n) = nΠprime∣nprime− 1prime那么对于我们区间乘来说因为小于300内的质数很少所以我们可以用long
ljq--linuxer
·
2020-09-12 10:55
ACM
DS-线段树
CodeForces
185A. Plant(矩阵快速幂)
题目链接:http://
codeforces
.com/problemset/problem/185/ADwarfshaveplantedaveryinterestingplant,whichisatriangledirected"upwards
田益铭
·
2020-09-12 09:18
快速幂
Codeforces
839D Winter is here (数论:容斥原理)
D.Winterisheretimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputWinterishereattheNorthandtheWhiteWalkersareclose.JohnSnowhasanarmyconsistingofnsoldiers.Whilet
会打架的程序员不是好客服
·
2020-09-12 09:34
CodeForces
Codeforces
-839D Winter is here(容斥原理)
D.Winterisheretimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputWinterishereattheNorthandtheWhiteWalkersareclose.JohnSnowhasanarmyconsistingofnsoldiers.Whilet
丿残念灬
·
2020-09-12 09:20
初等数论
Codeforces
839 D. Winter is here (莫比乌斯反演)
DescriptionWinterishereattheNorthandtheWhiteWalkersareclose.JohnSnowhasanarmyconsistingofnsoldiers.WhiletherestoftheworldisfightingfortheIronThrone,heisgoingtogetreadyfortheattackoftheWhiteWalkers.Heh
小坏蛋_千千
·
2020-09-12 09:16
组合数学
Codeforces
839D Winter is here【容斥原理+数学公式】
D.Winterisheretimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputWinterishereattheNorthandtheWhiteWalkersareclose.JohnSnowhasanarmyconsistingofnsoldiers.Whilet
mengxiang000000
·
2020-09-12 09:58
数论&&组合数学
思维
Codeforces
839 D. Winter is here 容斥
传送门:
Codeforces
839D题意:给出一个序列,求取出一个字序列,当他们的GCD大于1时,将贡献子序列所有数的gcd*子序列的长度,问总贡献是多少。
WA是一笔财富
·
2020-09-12 09:48
codeforces
数学
CodeForces
839D Winter is here (容斥原理)
题目链接:http://
codeforces
.com/problemset/problem/839/D题意:有n个士兵,每个士兵的力量值为a[i],现在按照输入的顺序选择k个数(即选择i,i+1,i+3
TooSIMple_
·
2020-09-12 09:23
CodeForces
数学
Codeforces
839D-Winter is here
Winterisheretimelimitpertest3secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputWinterishereattheNorthandtheWhiteWalkersareclose.JohnSnowhasanarmyconsistingofnsoldiers.Whilethe
Wang_128
·
2020-09-12 08:36
Codeforces
----组合数学
----容斥
CodeForces
839D Winter is here(数学 容斥)
题意:给你n个数,问你所有满足gcd>1的子集,每个子集贡献为子集内元素个数*子集gcd,问所有满足条件的集合的贡献和。思路:可以枚举gcd,计算每个gcd的贡献,设含因子i的个数为cnt[i],gcd为i的贡献个数为1*C(cnt[i],1)+2*C(cnt[i],2)+3*C(cnt[i],3)...+cnt[i]*C(cnt[i],cnt[i]))-i*2的贡献-i*3的贡献....,可以记
cillyb
·
2020-09-12 08:59
组合数学
codeforces
839d Winter is here
一场给dalao们吐槽到不行。全场B题最后终测挂了9/10的div2。hack频频出错。B题比D题还难的场。。多校中插一脚cf。hhhhhhh题目传送门题意:给一个序列,要求找一个可以不连续长度为k的子序列满足下标i11可以贡献p*k的价值。现在问对于这个序列的所有情况的贡献是多少。思路:其实可以不要被这个下标蒙蔽了。下标没什么的。只是限定你只能使用一次这个序列而已。比赛的时候发现其实对于每一个位
QuanQqqqq
·
2020-09-12 08:26
容斥
Educational
Codeforces
Round 80 (Rated for Div. 2) D. Minimax Problem
D.MinimaxProblem考虑二分答案,对于二分出的某个值x,先将原数组处理成二进制的形式,大于x的位为1,这样二进制数上限为2^8-1=255,然后暴力check。#include#definelllonglong#definePBpush_back#defineendl'\n'#defineINF0x3f3f3f3f#defineLINF0x3f3f3f3f3f3f3f3f#define
Thinking knife
·
2020-09-12 08:54
比赛题解
Codeforces
986A. Fair(对物品bfs暴力求解)
解题思路:1.对物品ibfs,更新每个小镇j获得每个物品i的最短距离。2.时间复杂度o(n*k*logk),满足2s的要求。代码:#include#include#include#include#include#includeusingnamespacestd;typedeflonglongll;#defineMAX2000000000inta[500050];liste[500050];intd
zhangjiuding
·
2020-09-12 08:32
【题解】[
codeforces
round #198 div2]Tourists problem
题目大意:有n个点分布在一条直线上,每个点有一个正数坐标(没有两个点坐标相同)。。现在从0位置出发,以任意顺序遍历这n个点(不回到0)。。。求出平均路线长度,用最简分数表示。把整个路径拆成一段一段的来分析。。包含直接从0到i的路径有(n-1)!条(可以把i排到第一个位置,其他n-1个点做全排列)然后包含直接从j到i的路径可以这么分析:先设i的位置比j小(因为题目本身没有这个限制,所以统计完了之后还
_zslzx_
·
2020-09-12 08:54
题解
决定了,把以前做过的CF,TC总结都补上来
Codeforces
:
Codeforces
Round#154(div2):http://
codeforces
.com/contest/253
Codeforces
Round#170(div2):http:
yew1eb
·
2020-09-12 08:08
ACM-套题总结
Codeforces
-984B - Minesweeper - 暴力
题解链接:https://www.lucien.ink/archives/210/题目链接:http://
codeforces
.com/contest/984/problem/B题目:OnedayAlexdecidedtorememberchildhoodwhencomputerswerenottoopowerfulandlotsofpeopleplayedonlydefaultgames.Ale
LucienShui
·
2020-09-12 08:18
题解
搜索
codeforces
336c
一开始想错了。想到要被2^k整除,那么找到最大的lowbit(x)即可。但是也有可能实际答案比lowbit还要大。所以应该直接枚举k,然后看是否有和2^k-1一系列与之后为0的,如果有的话说明k满足,k从大到小枚举即可。AC代码:#include#includeconstintMAX_NUMBER=100006;intvalue[MAX_NUMBER];intans[MAX_NUMBER];int
xcszbdnl
·
2020-09-12 08:02
ACM_数论
codeforces
B. Dreamoon Likes Permutations
题目题意:你有一个序列aaa,现在你可以把aaa分成两部分,但是要保证两个部分都有111~xxx中的每个整数都存在,且len=x−1+1len=x-1+1len=x−1+1也就是说每一部分数字唯一。思路:我们可以设置两个数组ql,qrql,qrql,qr,从头开始扫如果这个点满足上述条件,那么就将qlqlql置成truetruetrue,然后qrqrqr从后往前扫,最后从前往后遍历一遍,如果出现了
忘梦心
·
2020-09-12 08:15
codeforces
codeforces
题解
Codeforces
Round#666(Div.2)题解查看题解Educational
Codeforces
Round94(RatedforDiv.2)查看题解
Codeforces
Round#665(Div
忘梦心
·
2020-09-12 08:15
codeforces
Codeforces
Global Round 10 题解
A.OmkarandPassword查看题解数学B.OmkarandInfinityClock查看题解数学C.OmkarandWaterslide查看题解贪心D.OmkarandBedWars查看题解贪心E.OmkarandDuck查看题解构造
忘梦心
·
2020-09-12 08:15
codeforces
Codeforces
Round #228 (Div. 1) B. Fox and Minimal path (构造&最短路)
B.FoxandMinimalpathtimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputFoxCielwantstowriteataskforaprogrammingcontest.Thetaskis:"Youaregivenasimpleundirectedgrap
东野圭吾#
·
2020-09-12 08:28
图论
Codeforces
构造
Codeforces
Beta Round #77 (Div. 1 Only) C. Volleyball (二维最短路&贪心)
C.Volleyballtimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputPetyalovesvolleyballverymuch.Onedayhewasrunninglateforavolleyballmatch.Petyahasn'tboughthisownca
东野圭吾#
·
2020-09-12 08:57
Codeforces
最短路
[
CodeForces
- 208E] Blood Cousins(k代兄弟问题)
题目链接加强版例题(还没写)题意:给定一棵nnn个结点的树。给出mmm次询问,每次询问给出xxx和kkk,问xxx有多少个kkk代兄弟。(两个点互为kkk代兄弟的定义是他们的kkk级祖先相同)1≤n,m≤1051\leqn,m\leq10^{5}1≤n,m≤105做法:把所有点以深度为第一关键字,dfsdfsdfs序为第二关键字排序。然后kkk代兄弟一定是在一段连续的区间中的,这样就转化成区间问题
Zimba_
·
2020-09-12 08:23
树学
CodeForces
986C AND Graph (逻辑运算+思维+DFS)
题目链接题意:第一行给出一个n和m,随后一行是m个数据,数据范围是0~(1#include#include#include#include#include#include#include#includeusingnamespacestd;#definelllonglong#defineinf0x3f3f3f3fconstintmaxn=1<<23;boola[maxn];//用于记录哪个是给出的数
Fushicho_XF
·
2020-09-12 07:26
逻辑运算
思维
搜索
Codeforces
986B - Petr and Permutations
给定一个长度为n序列的排列,问改序列是由原序列进行3n还是7n+1次交换得到的由7n+1-3n=4n+1知道两个数奇偶性不同那么我们计算序列的奇偶性即可得补一种O(n)的做法1#include2#include3#include4usingnamespacestd;567intN;8constintmaxn=1e6+10;9intA[maxn];1011intmain(){12scanf("%d"
weixin_34013044
·
2020-09-12 07:13
Codeforces
Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) D. Little Artem and Dance 模拟
D.LittleArtemandDance题目连接:http://www.
codeforces
.com/contest/669/problem/DDescriptionLittleArtemisfondofdancing.MostofalldancesArtemlikesrueda—Cubandancethatisdancedbypairsofboysandgirlsformingacirclea
weixin_33830216
·
2020-09-12 07:03
2018-2019 ACM-ICPC Southeastern European Regional Programming Contest (SEERC 2018)
2019ACM-ICPCSoutheasternEuropeanRegionalProgrammingContest(SEERC2018)author:"luowentaoaa"catalog:truetags:mathjax:true-
codeforces
B.BrokenWatch
weixin_30858241
·
2020-09-12 07:50
Codeforces
Round #233 (Div. 2)D. Painting The Wall 概率DP
D.PaintingTheWallUseraintadecidedtopaintawall.Thewallconsistsofn2tiles,thatarearrangedinann × ntable.Sometilesarepainted,andtheothersarenot.Ashewantstopaintitbeautifully,hewillfollowtherulesbelow.Firs
weixin_30794499
·
2020-09-12 07:48
CodeForces
- 987E Petr and Permutations (思维+逆序对)
题意:初始有一个序列[1,2,...N],一次操作可以将任意两个位置的值互换,Petr做3*n次操作;Alxe做7*n+1次操作。给出最后生成的新序列,问是由谁操作得到的。分析:一个序列的状态可以归为:由原序列操作奇数次得到(简称奇序列);和操作偶数次(偶序列)得到。显然奇序列中,逆序对的个数为奇数;偶序列中,逆序对的个数为偶。当n为奇数时,3*n为奇,7*n+1为偶;n为偶数时正好相反。用树状数
weixin_30675967
·
2020-09-12 07:13
Atcoder&
CodeForces
杂题11.6
PrefaceNOIP前突然不知道做什么,感觉思维有点江僵化,就在vjudge上随便组了6道ABCD+CFDiv2C/D做,发现比赛质量还不错,知识点涉及广,难度有梯度,码量稍小,思维较多.同时发现vjudge的比赛功能很不错A.ABC112-D-Partition难度感觉比NOIPT1简单了些了首先naiive的想法是枚举这个公约数\(D\),但是发现有\(D*N=1;i--){if(m%i==
weixin_30652491
·
2020-09-12 07:11
Codeforces
986B. Petr and Permutations(没想到这道2250分的题这么简单,早知道就先做了)...
这题真的只能靠直觉了,我没法给出详细证明。解题思路:1.交换3n次或者7n+1次,一定会出现一个为奇数,另一个为偶数。2.用最朴素的方法,将n个数字归位,计算交换次数。3.判断交换次数是否与3n的奇偶性相同,相同输出Petr;不相同则一定与7n+1的奇偶性相同,输出Um_nik。代码:#includeusingnamespacestd;typedeflonglongll;inta[1000010]
weixin_30614587
·
2020-09-12 07:39
codeforces
669D D. Little Artem and Dance(乱搞题)
题目链接:D.LittleArtemandDancetimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputLittleArtemisfondofdancing.MostofalldancesArtemlikesrueda—Cubandancethatisdancedby
weixin_30466953
·
2020-09-12 07:01
CF补题
CodeForce过题数/总题数ABCDEFGHEducational
Codeforces
Round64(RatedforDiv.2)1/7ACWA**
Codeforces
Round#556(Div.2
weixin_30262255
·
2020-09-12 07:21
CodeForces
669D(小思维+负数取模)
题目链接:http://
codeforces
.com/problemset/problem/669/D题意:q次按顺序操作,操作1:整体移动给定单位距离;操作2:奇偶位互换,要求输出q次操作后的情况思路
weixin_30247307
·
2020-09-12 07:20
CodeForces
398B Painting The Wall 概率DP
题目大意:就是现在有一个n*n的墙,初始的时候有m个位置被涂过,现在每次从中随机选一个位置,如果没有涂过就涂上,如果涂过就什么也不做,问需要经过多少次选择使得每行每列都有被涂过的格子大致思路:简直和2014年牡丹江现场赛的D题惊人相似...转移方程细节见代码代码如下:Result:AcceptedMemory:31356KBTime:124ms/**Author:Gatevin*CreatedTi
Gatevin
·
2020-09-12 07:45
ACM_Probability
Codeforces
CodeForces
398B
Painting
The
Wall
概率DP
Codeforces
目录
Codeforces
Round#277(Div.2)
Codeforces
Round#276(Div.2)
Codeforces
Round#275(Div.2)
Codeforces
Round#274(Div
CHEBEATER
·
2020-09-12 07:32
Codeforces补番
Codeforces跟番
Codeforces
Round 444 div2 D two pointer + 贪心
D.RatingsandRealityShowstimelimitpertest2secondsmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputTherearetwomainkindsofeventsinthelifeoftop-model:fashionshowsandphotoshoots.Particip
三级头不怕通
·
2020-09-12 07:45
codeforces
【索引】
Codeforces
Round #262 (Div. 2)
ProblemA:VasyaandSocks(460A)ProblemB:LittleDimaandEquation(460B)ProblemC:Present(460C)ProblemD:LittleVictorandSet(460D)ProblemE:RolandandRose(460E)
JeraKrs
·
2020-09-12 07:43
索引
Codeforces
398B Painting The Wall(dp)
题目链接:
Codeforces
398BPaintingTheWall题目大意:给出n和m,表示在一个n*n的平面上有n*n个瓷砖,其中有m块已经涂色。
JeraKrs
·
2020-09-12 07:43
CF
动态规划-基础
GRADE:A
CodeForces
189 A
题目链接~~>做题感悟:比赛时做的这道题,开始想暴力但是因为近段时间在看背包,看见这题就想到用完全背包可以解决,但是做了两个小时也没做出来,最后想暴力但是暴力错了。解题思路:(1)暴力:给三个数排序,因为大的数需要的总个数少,所以遍历两个大的数(两层for循环,已经知道两个大的数,小的数可以解出来)。(2)完全背包:必须恰好装满,所以初始化很重要(背包总结),然后以个数为价值,尽量选价值多,容量为
Bjut_Search2016
·
2020-09-12 07:42
ACM算法
CodeForces
275C 贪心
Ak-multiplefreesetisasetofintegerswherethereisnopairofintegerswhereoneisequaltoanotherintegermultipliedbyk.Thatis,therearenotwointegersxandy(x #include#include#includeusingnamespacestd;intn,k,i,j;long
lab104_yifan
·
2020-09-12 07:11
CodeForces
919B(枚举)
题目链接:点击打开链接题目大意:输入一个k,找到第K个满足各位相加等于10的数字题目思路:纸上写一下就会发现前一百每个数字之间隔9,然后过了100以后有时候会隔9不满足,但是没关系,check一下就好了以下是代码:#include#includeusingnamespacestd;boolcheck(intx){intk=x,sum=0;while(k!=0){sum+=k%10;k/=10;}i
smilestruggler
·
2020-09-12 07:57
枚举
Codeforces
Round #485 (Div. 2) - E - Petr and Permutations
传送门:点击打开链接题意:给出一个1-n的随机排列,问这个序列是交换3*n次形成的,还是交换7*n+1次形成的。分析:首先,3*n和7*n+1的奇偶性一定不同,线性代数中学过,交换序列中任意两个元素,会使序列逆序对的奇偶性发生改变一次,所以只需快速求出逆序对就行。用归并、树状数组、线段树都行。另外负数取余,取余的结果与被取余的数保持一致,如果不确定正负,就先使用绝对值再取余。也可以直接求出最少交换
Self-Discipline
·
2020-09-12 07:55
ACM
算法
Codeforces
1267 A Apprentice Learning Trajectory——贪心
Thisway题意:有n个房子,第i个房子开放时间从li到ri,在这个房间内铸一把剑要ti的时间。同一时间只能在一个房子内铸剑,同一时间只能铸一把剑,并且直到铸完才能离开。问你最多能铸多少剑题解:考虑如果现在一个房间都没开,那么从这个时间开始,铸完剑最快的那个房间一定是当前最优的,因为之后我们就有更多的时间。如果当前有多个房间开启,那么直到下一个房间开启或者某一个房间关闭为止,铸剑时间最短的那个房
天翼之城*
·
2020-09-12 07:23
想法
上一页
65
66
67
68
69
70
71
72
下一页
按字母分类:
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
其他