
水题
文章平均质量分 82
qwe585p
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C - Find The Multiple(BFS)
解题过程:直接暴搜;解题思路:1,首先这个由01组成的数的开头一定是1。2,每次在后面添上0或1 对所给的数取余,若为0则为这个数的解,不为0就继续在后面加0或加1。如此反复直到有解。Tips:因为没做时间空间的优化,用C++编译器可能会TLE,用G++才能AC。DescriptionGiven a positive integer n, write a p原创 2015-06-21 15:18:20 · 611 阅读 · 1 评论 -
CodeForces 558A Lala Land and Apple Trees(模拟)
题意:小女孩摘苹果,一开始小女孩在原点0,左右两边正负X轴的整数位置有若干苹果树,给出苹果树的位置和苹果树上苹果的数量。小女孩的移动方式是,开始可以向左或者向右,但摘完一颗苹果树后,必须反向行走(ex:开始向右x正轴行走, 摘完一颗苹果树,就在向左x负轴行走),若干次后,如果她所行走的哪个方向没有苹果树了(都摘过了),就结束。最多摘多少个苹果。解题思路:使用两个结构数组分别储存正轴和负轴的苹果原创 2015-08-23 10:25:10 · 789 阅读 · 0 评论 -
CodeForces 546C Soldier and Cards(数据结构模拟)
题意:两个人各有一堆牌,每次都出最上面的一张牌,记为一次操作,牌上有个权值, 权值大的获胜,先把对方刚才出的牌放在自己牌堆的最下方,再把自己刚出的牌放在最下方。什么时候一个人的牌堆没有牌了,谁就输了,即对方获胜,输出操作的总次数,和获胜的一方是谁。若始终无法有人获胜(出现无限循环了),就输出-1.解题思路:使用队列模拟两个牌堆的操作,输入就分别压入两个队列,比较时弹出队头元素, 比较大小,获胜原创 2015-08-23 10:42:01 · 457 阅读 · 0 评论 -
HDU-1029 Ignatius and the Princess IV
题意:求所给序列中出现次数最多的数字,保证该数字至少出现(N+1)/2 次解题思路:不知道这个题为什么归到dp中了,沙茶题,排序找中位数,完事。Description"OK, you are not too bad, em... But you can never pass the next test." feng5166 says. "I will tell原创 2015-08-22 14:54:11 · 327 阅读 · 0 评论 -
POJ 3633
#include#include#include#include#include#include#include#include#include#include#include#includeusing namespace std;#define MAX_Nconst int INF = 0x3f3f3f3f;struct node{ int id, t原创 2015-08-20 16:25:03 · 510 阅读 · 0 评论 -
Codeforces Round #303 (Div. 2) A - Equidistant String(贪心)
题意:给定两个由0,1组成的相同长度的序列,求到两个序列汉明距离相同的由0,1组成的序列,若有多个输出一个即可。解题思路:首先若是存在所求序列, 那么所给的两个串的对应相同下标不同的数字的个数 ,一定为偶数。然后就是把这个 偶数 / 2个 与第一个串(与第二个串数字不同)相同, 另外一半与第二个串(与第一个串对应数字不同)相同, 两个串对应位置相同的地方, 所求串也相同。De原创 2015-08-17 10:55:27 · 364 阅读 · 0 评论 -
HDU 4690 EBCDIC(水题,练仔细)
题意:相互映射就行了解题思路:直接搞打表,注意空位搞点东西上去,敲完代码手残了。敲敲改改弄了40分钟。A mad scientist found an ancient message from an obsolete IBN System/360 mainframe. He believes that this message contains some very import原创 2015-08-26 19:28:32 · 634 阅读 · 0 评论 -
UVA 253 Cube painting(思维题)
题意:略解题思路:所有可能全部枚举, 我估计我是解这个题,方法最笨,代码量最长的人,就别参考了,尽情的笑话我吧。DescriptionWe have a machine for painting cubes. It is supplied with three different colors: blue, red and green. Each face of t原创 2015-08-27 11:05:19 · 415 阅读 · 0 评论 -
UVA-572 Oil Deposits(BFS)
简单题 之前DFS做过一遍, 再用BFS复习一下。。()原创 2015-06-11 19:32:15 · 405 阅读 · 0 评论 -
Codeforces Round #292 (Div. 2) -- A. Drazil and Date
大水,因为一定是从(0,0)到(a,b)最短距离就是sum = |a|+|b| 因为a,b 可能为负,所以加绝对值在终点来个滑步就是sum+2,再来一个再+2,所以只要是s > a + b,(s-sum)% 2 !=0 就到不了,s = a + b正好到 s DescriptionSomeday, Drazil wanted to go on date with Varda原创 2015-06-10 11:39:48 · 388 阅读 · 0 评论 -
CodeForces 515C. Drazil and Fa
想了一段时间,最后从纯数学的角度上解决的。首先读入这个串,因为素数是不可以被分解的,所以只要是素数,就整个的保留下来,如果是合数就分解成素数。4!被分解为3!*2!*2!6! = 5! * 3!8! = 7! * 2! * 2! * 2!9! = 7! * 3! * 3! * 2!最后再用sort()反向排一下序,输出即可,碰到0和1跳过不管即可。Descr原创 2015-06-10 11:51:09 · 594 阅读 · 0 评论 -
Codeforces Round #295 A. Pangram
大水,先判断大小写,然后记录一下,最后查一下记录结果。完成.DescriptionA word or a sentence in some language is called a pangram if all the characters of the alphabet of this language appear in it at least once. Pangra原创 2015-06-10 11:17:14 · 427 阅读 · 0 评论 -
CodeForces - 514A Chewbaсca and Number
注意一下,前导0,的情况即可,大于5就搞出来,用字符串来搞。DescriptionLuke Skywalker gave Chewbacca an integer number x. Chewbacca isn't good at numbers but he loves inverting digits in them. Inverting digit t means原创 2015-06-10 12:52:08 · 491 阅读 · 0 评论 -
Codeforces Round #293 (Div. 2)--A-- Vitaly and Strings - Painting
小水,WA了几次,其实不用想太多,因为str1的字典序题目中说肯定比str2的小,所以只要让str1的字典序加上1即可,所以要倒着循环,如果最后是z就要考虑进位的因素。最后在比较一下,str1 != str2 就输出就行了!!!DescriptionVitaly is a diligent student who never missed a lesson in his f原创 2015-06-10 11:28:35 · 667 阅读 · 0 评论 -
Codeforces Round #294 (Div. 2) -- A. A and B and Chess
大水,先区分大小写,分别累加,最后比较一下大小就好了。DescriptionA and B are preparing themselves for programming contests.To train their logical thinking and solve problems better, A and B decided to play chess.原创 2015-06-10 11:24:42 · 417 阅读 · 0 评论 -
Looksery Cup 2015 A. Face Detection
怎么说呢,这个题还是很简单的,循环遍历矩阵,每个位置上的4个数[ i ][ j ] ,[ i + 1][ j ], [ i ][ j + 1], [i + 1][j + 1].对应的字符+1,判断是不是f,a,c,e。如果是cnt++,然后ok清零如果不是ok直接清零,防止影响后边的计算。The developers of Looksery have原创 2015-06-07 12:13:35 · 550 阅读 · 0 评论 -
Codeforces Round #306 (Div. 2)---A. Two Substrings
这道题很简单,注意ABA和BAB 既可以当做AB也可以当做BA但不可以同时当做AB,BA即可,同时注意嵌套的两个同级的for 只走一遍就可以,因为第一次如果找不到,缩小范围后更不可能找到,可以节省大量时间,防止TLE。#include#include#include#include#include#includeusing namespace std;原创 2015-06-05 17:00:17 · 384 阅读 · 0 评论 -
Codeforces Round #305 (Div. 2)--A. Mike and Fax
判断回文串的程序,注意每个串的长度要求一致。然后一个串一个串的检查是不是回文串就好了。#include#include#include#include#includeusing namespace std;char s[2000];int main(){ int n; cin>>s>>n; int len = strlen(s); if( l原创 2015-06-05 17:07:37 · 503 阅读 · 0 评论 -
CodeForces 551A GukiZ and Contest(模拟)
题意:根据获得的等级排名次,等级相同的获得相同的名次,出现相同等级的下一个名次,获得他的真实名次(等级在他前面的人数 + 1),比如等级为 3 3 1,则根据规则前两人获得名次1, 第三人获得名次在他前面的人数 + 1, 就是3 输出 1 1 3.解题思路:结构数组记录他们的位置和等级, 根据等级排降序,根据上述规则给他们指定名次就好了。Professor GukiZ like原创 2015-08-23 10:32:30 · 469 阅读 · 0 评论