-
[综合] (求连通分量的个数-基础并查集)hdu1213 How Many Tables
hdu1213HowManyTables 基础并查集。 #include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> us...
98
热度 -
[综合] (判环-基础并查集)hdu1272 小希的迷宫
传送门:hdu1272小希的迷宫 目录 错误代码: 正确代码: 判断是否能形成环即可。代码wa,还没找出错QWQ。-------找出错误了。 错在连通分量只能有一个,如果连通分量大于1,输出no。 错误代码: //错误代码: #include<iostream> #include<...
43
热度 -
[综合] (求某个集合中元素的个数-基础并查集)poj1611 The Suspects
传送门:poj1611TheSuspects #include<iostream> #include<cstdio> #include<cmath> #include<cstring> #include<algorithm> usingna...
82
热度 -
[综合] (简单回溯) P2404 自然数的拆分问题
P2404自然数的拆分问题 题目背景 任何一个大于1的自然数n,总可以拆分成若干个小于n的自然数之和。 题目描述 任何一个大于1的自然数n,总可以拆分成若干个小于n的自然数之和。 输入输出格式 输入格式: 输入:待拆分的自然数n。 输出格式: 输出:若干数的加法式子。 输入输出样例 输入样例...
63
热度 -
[综合] (模拟题)B. Vova and Trophies—— Educational Codeforces Round 55 (Rated for Div. 2)
传送门:B.VovaandTrophies 题意:给你一个长度为n且只由'G','S'组成的字符串,'G','S'的位置最多互换一次,问连续'G'的最大长度? 思路:看到题目,感觉O(n)的时间复杂度就能实现,时限2s,足够了。设置cnt1,cnt2分别存取一个'S'左右的连续的‘G’的最大长度。 ...
89
热度 -
[综合] (模拟)A. Vasya and Book—— Educational Codeforces Round 55 (Rated for Div. 2)
传送门:A.VasyaandBook 题解: 向左翻d页,如果翻超界,那就是翻到第一页; 向右翻d页,如果翻超界,那就是翻到第n页。 #include<cstdio> #include<iostream> #include<algorithm> #includ...
90
热度 -
[综合] (回溯)ZOJ1002 Fire Net
传送门:ZOJ1002FireNet 哈哈哈,其实这道题目只是八皇后题目的简单变形,一开始,感觉自己做不上来,就直接搜答案。看了几个题解,感觉写得很复杂,也不想看。于是,自己独立试着分析,不出半个小时就做完啦,,, 好了,不啰嗦啦~直接说思路吧 回溯其实就是搜索式的枚举,对于一行中的每一列,如果这个...
97
热度 -
53
热度 -
[综合] PAT甲级 - 1004 Counting Leaves (30 分)
题目链接:(PAT甲级)1004CountingLeaves(30分) Afamilyhierarchyisusuallypresentedbyapedigreetree.Yourjobistocountthosefamilymemberswhohavenochild. InputSpecifica...
39
热度 -
[综合] PAT甲级 - 1005 Spell It Right (20 分)
题目链接:PAT甲级-1005SpellItRight(20分) Givenanon-negativeintegerN,yourtaskistocomputethesumofallthedigitsofN,andoutputeverydigitofthesuminEnglish. InputSpec...
66
热度 -
[综合] PAT甲级 - 1006 Sign In and Sign Out (25 分)
题目链接:PAT甲级-1006SignInandSignOut(25分) Atthebeginningofeveryday,thefirstpersonwhosignsinthecomputerroomwillunlockthedoor,andthelastonewhosignsoutwillloc...
110
热度 -
[综合] PAT甲级 - 1007 Maximum Subsequence Sum (25 分)
题目链接:PAT甲级-1007MaximumSubsequenceSum(25分) GivenasequenceofKintegers{N?1??,N?2??,...,N?K??}.Acontinuoussubsequenceisdefinedtobe{N?i??,N?i+1??,...,N?j??...
79
热度 -
[综合] PAT甲级 - 1008 Elevator (20 分)
题目链接:PAT甲级-1008Elevator(20分) Thehighestbuildinginourcityhasonlyoneelevator.ArequestlistismadeupwithNpositivenumbers.Thenumbersdenoteatwhichfloorstheel...
33
热度 -
[综合] PAT甲级 - 1010 Radix (25 分)
题目链接:PAT甲级-1010Radix(25分) Givenapairofpositiveintegers,forexample,6and110,canthisequation6=110betrue?Theanswerisyes,if6isadecimalnumberand110isabinary...
113
热度 -
[综合] PAT甲级 - 1011 World Cup Betting (20 分)
题目链接:PAT甲级-1011WorldCupBetting(20分) Withthe2010FIFAWorldCuprunning,footballfanstheworldoverwerebecomingincreasinglyexcitedasthebestplayersfromthebestt...
51
热度 -
[综合] PAT甲级 - 1012 The Best Rank (25 分)
题目链接:PAT甲级-1012TheBestRank(25分) ToevaluatetheperformanceofourfirstyearCSmajoredstudents,weconsidertheirgradesofthreecoursesonly:C-CProgrammingLanguage...
102
热度 -
[综合] (简单双向BFS)poj1915 Knight Moves
题目链接:poj1915KnightMoves 比起单向要省时得多。 #include<iostream> #include<cstdio> #include<cmath> #include<queue> #include<cstring>...
65
热度 -
[综合] PAT甲级 - 1013 Battle Over Cities (25 分)
题目链接:PAT甲级-1013BattleOverCities(25分) Itisvitallyimportanttohaveallthecitiesconnectedbyhighwaysinawar.Ifacityisoccupiedbytheenemy,allthehighwaysfrom/to...
52
热度 -
[综合] PAT甲级 - 1014 Waiting in Line (30 分)
题目链接:PAT甲级-1014WaitinginLine(30分) SupposeabankhasNwindowsopenforservice.Thereisayellowlineinfrontofthewindowswhichdevidesthewaitingareaintotwoparts.Th...
50
热度 -
[综合] PAT甲级 - 1015 Reversible Primes (20 分)
题目链接:PAT甲级-1015ReversiblePrimes(20分) Areversibleprimeinanynumbersystemisaprimewhose"reverse"inthatnumbersystemisalsoaprime.Forexampleinthedecimalsyste...
108
热度