07 2017 档案

 
PAT 乙级 1007. 素数对猜想 (20)
摘要:让我们定义 dn 为:dn = pn+1 - pn,其中 pi 是第i个素数。显然有 d1=1 且对于n>1有 dn 是偶数。“素数对猜想”认为“存在无穷多对相邻且差为2的素数”。 现给定任意正整数N (< 105),请计算不超过N的满足猜想的素数对的个数。 输入格式:每个测试输入包含1个测试用例, 阅读全文
posted @ 2017-07-31 15:43 Annetree 阅读(147) 评论(0) 推荐(0)
PAT 乙级1003. 我要通过!(20)
摘要:“答案正确”是自动判题系统给出的最令人欢喜的回复。本题属于PAT的“答案正确”大派送 —— 只要读入的字符串满足下列条件,系统就输出“答案正确”,否则输出“答案错误”。 得到“答案正确”的条件是: 1. 字符串中必须仅有P, A, T这三种字符,不可以包含其它字符;2. 任意形如 xPATx 的字符 阅读全文
posted @ 2017-07-31 15:17 Annetree 阅读(144) 评论(0) 推荐(0)
PAT 乙级 1066. 图像过滤(15)
摘要:图像过滤是把图像中不重要的像素都染成背景色,使得重要部分被凸显出来。现给定一幅黑白图像,要求你将灰度值位于某指定区间内的所有像素颜色都用一种指定的颜色替换。 输入格式: 输入在第一行给出一幅图像的分辨率,即两个正整数M和N(0 < M, N <= 500),另外是待过滤的灰度值区间端点A和B(0 < 阅读全文
posted @ 2017-07-31 14:50 Annetree 阅读(116) 评论(0) 推荐(0)
PAT 乙级 1061. 判断题(15)
摘要:判断题的评判很简单,本题就要求你写个简单的程序帮助老师判题并统计学生们判断题的得分。 输入格式: 输入在第一行给出两个不超过100的正整数N和M,分别是学生人数和判断题数量。第二行给出M个不超过5的正整数,是每道题的满分值。第三行给出每道题对应的正确答案,0代表“非”,1代表“是”。随后N行,每行给 阅读全文
posted @ 2017-07-31 14:42 Annetree 阅读(124) 评论(0) 推荐(0)
PAT 乙级 1056. 组合数的和(15)
摘要:给定N个非0的个位数字,用其中任意2个数字都可以组合成1个2位的数字。要求所有可能组合出来的2位数字的和。例如给定2、5、8,则可以组合出:25、28、52、58、82、85,它们的和为330。 输入格式: 输入在一行中先给出N(1<N<10),随后是N个不同的非0个位数字。数字间以空格分隔。 输出 阅读全文
posted @ 2017-07-31 14:34 Annetree 阅读(128) 评论(0) 推荐(0)
PAT 乙级 1051. 复数乘法 (15)
摘要:复数可以写成(A + Bi)的常规形式,其中A是实部,B是虚部,i是虚数单位,满足i2 = -1;也可以写成极坐标下的指数形式(R*e(Pi)),其中R是复数模,P是辐角,i是虚数单位,其等价于三角形式 R(cos(P) + isin(P))。 现给定两个复数的R和P,要求输出两数乘积的常规形式。 阅读全文
posted @ 2017-07-31 14:29 Annetree 阅读(189) 评论(0) 推荐(0)
PAT 乙级 1046. 划拳(15)
摘要:划拳是古老中国酒文化的一个有趣的组成部分。酒桌上两人划拳的方法为:每人口中喊出一个数字,同时用手比划出一个数字。如果谁比划出的数字正好等于两人喊出的数字之和,谁就赢了,输家罚一杯酒。两人同赢或两人同输则继续下一轮,直到唯一的赢家出现。 下面给出甲、乙两人的划拳记录,请你统计他们最后分别喝了多少杯酒。 阅读全文
posted @ 2017-07-31 11:01 Annetree 阅读(188) 评论(0) 推荐(0)
HDU 6050 17多校2 Funny Function(数学+乘法逆元)
摘要:Problem Description Function Fx,ysatisfies:For given integers N and M,calculate Fm,1 modulo 1e9+7. Input There is one integer T in the first line.The 阅读全文
posted @ 2017-07-29 13:53 Annetree 阅读(387) 评论(0) 推荐(0)
HDU 6047 17多校 Maximum Sequence(优先队列)
摘要:Problem Description Steph is extremely obsessed with “sequence problems” that are usually seen on magazines: Given the sequence 11, 23, 30, 35, what i 阅读全文
posted @ 2017-07-28 14:46 Annetree 阅读(305) 评论(0) 推荐(0)
HDU 6055 17多校 Regular polygon(计算几何)
摘要:Problem Description On a two-dimensional plane, give you n integer points. Your task is to figure out how many different regular polygon these points 阅读全文
posted @ 2017-07-28 13:46 Annetree 阅读(242) 评论(0) 推荐(0)
HDU 6045 17多校2 Is Derek lying?
摘要:题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=6045 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s 阅读全文
posted @ 2017-07-28 13:12 Annetree 阅读(137) 评论(0) 推荐(0)
HDU6043 17多校1 KazaQ's Socks 水题
摘要:题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=6043 Problem Description KazaQ wears socks everyday.At the beginning, he has n pairs of socks numbered 阅读全文
posted @ 2017-07-26 10:19 Annetree 阅读(181) 评论(0) 推荐(0)
17 多校1 Add More Zero 水题
摘要:Problem Description There is a youngster known for amateur propositions concerning several mathematical hard problems.Nowadays, he is preparing a thou 阅读全文
posted @ 2017-07-26 09:59 Annetree 阅读(397) 评论(0) 推荐(0)
POJ 3461 Oulipo(KMP裸题)
摘要:Description The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group 阅读全文
posted @ 2017-07-24 11:02 Annetree 阅读(257) 评论(0) 推荐(0)
FZU 2273 Triangles 第八届福建省赛 (三角形面积交 有重边算相交)
摘要:Problem Description This is a simple problem. Given two triangles A and B, you should determine they are intersect, contain or disjoint. (Public edge 阅读全文
posted @ 2017-07-24 10:42 Annetree 阅读(583) 评论(0) 推荐(0)
FZU 2272 Frog 第八届福建省赛 (鸡兔同笼水题)
摘要:Problem Description Therearex frogs and y chicken in a garden. Kim found there are n heads and m legs in the garden. Please tell Kim how many frogs an 阅读全文
posted @ 2017-07-24 09:59 Annetree 阅读(184) 评论(0) 推荐(0)
HDU 1166 敌兵布阵(线段树点更新区间求和裸题)
摘要:Problem Description C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的 阅读全文
posted @ 2017-07-21 15:50 Annetree 阅读(158) 评论(0) 推荐(0)
poj 2251 Dungeon Master (BFS 三维)
摘要:You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. 阅读全文
posted @ 2017-07-19 15:27 Annetree 阅读(174) 评论(0) 推荐(0)
16 多校 8 Ball (贪心排序)很巧妙的思路啊~
摘要:ZZX has a sequence of boxes numbered 1,2,...,n1,2,...,n. Each box can contain at most one ball. You are given the initial configuration of the balls. 阅读全文
posted @ 2017-07-19 14:32 Annetree 阅读(400) 评论(0) 推荐(0)
16 多校8 Rikka with Parenthesis II
摘要:As we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is one of them: Correct 阅读全文
posted @ 2017-07-18 16:23 Annetree 阅读(186) 评论(0) 推荐(0)
什么时候用深搜(dfs)什么时候用广搜(bfs)(转)
摘要:1.BFS是用来搜索最短径路的解是比较合适的,比如求最少步数的解,最少交换次数的解,因为BFS搜索过程中遇到的解一定是离根最近的,所以遇到一个解,一定就是最优解,此时搜索算法可以终止。这个时候不适宜使用DFS,因为DFS搜索到的解不一定是离根最近的,只有全局搜索完毕,才能从所有解中找出离根的最近的解 阅读全文
posted @ 2017-07-18 11:03 Annetree 阅读(2333) 评论(0) 推荐(1)
POJ 3278 Catch That Cow (bfs)
摘要:Farmer John has been informed of the location of a fugitive cow and wants to catch her immediately. He starts at a point N (0 ≤ N ≤ 100,000) on a numb 阅读全文
posted @ 2017-07-18 10:56 Annetree 阅读(156) 评论(0) 推荐(0)
POJ 1321 棋盘问题 (dfs)
摘要:在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将 阅读全文
posted @ 2017-07-18 10:20 Annetree 阅读(169) 评论(0) 推荐(0)
HDU 4463 Outlets(最小生成树给坐标)
摘要:Problem Description In China, foreign brand commodities are often much more expensive than abroad. The main reason is that we Chinese people tend to t 阅读全文
posted @ 2017-07-18 09:46 Annetree 阅读(383) 评论(0) 推荐(0)
POJ 1287 Networking(最小生成树裸题有重边)
摘要:Description You are assigned to design network connections between certain points in a wide area. You are given a set of points in the area, and a set 阅读全文
posted @ 2017-07-17 16:41 Annetree 阅读(302) 评论(0) 推荐(0)
BZOJ 1083 [SCOI2005]繁忙的都市 (最小生成树裸题无重边) 超简单写法!!
摘要:Description 城市C是一个非常繁忙的大都市,城市中的道路十分的拥挤,于是市长决定对其中的道路进行改造。城市C的道路是这样分布的:城市中有n个交叉路口,有些交叉路口之间有道路相连,两个交叉路口之间最多有一条道路相连接。这些道路是双向的,且把所有的交叉路口直接或间接的连接起来了。每条道路都有一 阅读全文
posted @ 2017-07-17 15:51 Annetree 阅读(124) 评论(0) 推荐(0)
POJ 1065 Wooden Sticks (贪心)
摘要:There is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine 阅读全文
posted @ 2017-07-15 16:27 Annetree 阅读(217) 评论(0) 推荐(0)
POJ 3299 Humidex
摘要:Adapted from Wikipedia, the free encyclopedia The humidex is a measurement used by Canadian meteorologists to reflect the combined effect of heat and 阅读全文
posted @ 2017-07-15 16:25 Annetree 阅读(221) 评论(0) 推荐(0)
HDU 1004 Let the Balloon Rise(map应用)
摘要:Problem Description Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is gues 阅读全文
posted @ 2017-07-15 11:48 Annetree 阅读(134) 评论(0) 推荐(0)
POJ 2234 Matches Game(Nim博弈裸题)
摘要:Description Here is a simple game. In this game, there are several piles of matches and two players. The two player play in turn. In each turn, one ca 阅读全文
posted @ 2017-07-15 10:29 Annetree 阅读(213) 评论(0) 推荐(0)
2016 多校联赛7 Elegant Construction
摘要:Being an ACMer requires knowledge in many fields, because problems in this contest may use physics, biology, and even musicology as background. And no 阅读全文
posted @ 2017-07-14 14:52 Annetree 阅读(113) 评论(0) 推荐(0)
2016 多校联赛7 Joint Stacks (优先队列)
摘要:A stack is a data structure in which all insertions and deletions of entries are made at one end, called the "top" of the stack. The last entry which 阅读全文
posted @ 2017-07-14 13:57 Annetree 阅读(213) 评论(0) 推荐(0)
2016 多校联赛7 Balls and Boxes(概率期望)
摘要:Mr. Chopsticks is interested in random phenomena, and he conducts an experiment to study randomness. In the experiment, he throws n balls into m boxes 阅读全文
posted @ 2017-07-14 10:28 Annetree 阅读(217) 评论(0) 推荐(0)
HDU 2585 Hotel(字符串的模糊匹配+递归)
摘要:Problem Description Last year summer Max traveled to California for his vacation. He had a great time there: took many photos, visited famous universi 阅读全文
posted @ 2017-07-10 11:11 Annetree 阅读(254) 评论(0) 推荐(0)
HDU 2013(递归)
摘要:Problem Description 喜欢西游记的同学肯定都知道悟空偷吃蟠桃的故事,你们一定都觉得这猴子太闹腾了,其实你们是有所不知:悟空是在研究一个数学问题!什么问题?他研究的问题是蟠桃一共有多少个!不过,到最后,他还是没能解决这个难题,呵呵^-^当时的情况是这样的:第一天悟空吃掉桃子总数一半多 阅读全文
posted @ 2017-07-10 10:05 Annetree 阅读(159) 评论(0) 推荐(0)
HDU 2012 素数判定
摘要:Problem Description 对于表达式n^2+n+41,当n在(x,y)范围内取整数值时(包括x,y)(-39<=x<y<=50),判定该表达式的值是否都为素数。 Input 输入数据有多组,每组占一行,由两个整数x,y组成,当x=0,y=0时,表示输入结束,该行不做处理。 Output 阅读全文
posted @ 2017-07-10 09:59 Annetree 阅读(202) 评论(0) 推荐(0)
POJ 2409 Let it Bead(polya裸题)
摘要:题目传送:http://poj.org/problem?id=2409 Description "Let it Bead" company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from t 阅读全文
posted @ 2017-07-07 16:10 Annetree 阅读(167) 评论(0) 推荐(0)
记第二届团体程序设计天梯赛
摘要:这次的发挥吧。。。。跟去年几乎没有差别。。。。还是前一学期浪费了时间 不过学校整体有进步,去年是三等奖第一名,这就很尴尬了 这次初赛在杭电打,决赛在工商,然后颁奖又去杭电 就放几张照片就好 噢对,然后这次拿了PAT80元代金券和100元奖金 报了9月的PAT乙级。。我怂不敢报甲级 希望我能默默地10 阅读全文
posted @ 2017-07-07 11:39 Annetree 阅读(160) 评论(0) 推荐(0)
记第十四届省赛参赛体会&第十三届
摘要:emmm....时间还是很久远了 还是流水账 这次比赛我还是挺开心的 因为感觉我们余神就是一把宝剑,然后我是她的Buff 前面四道题就挺顺利都1A过了,十年余神就是强无敌呀 最后两分钟过了第五题,银牌,嘿嘿嘿这最后一A我也是贡献的呀 颁奖前很紧张,不知道有没有银,出来之后超开心的 这次的队名取的超感 阅读全文
posted @ 2017-07-07 11:35 Annetree 阅读(179) 评论(0) 推荐(0)
记第二届CCPC全国女生赛参赛体验
摘要:离比赛时间已经有点久了,今天整理博客看到“”参赛体会“”这一分类,觉得记录一下也好 流水账记一下感受 因为题目我已经忘记了。。 第一次。。那么久。。大概有三个多小时在金牌区吧。。 然后就是一无所出了。。 杭电的伙食还是很好(粮票分量足呀),今年已经去杭电好多次了感觉,天梯就去了两次 感觉衣服比去年合 阅读全文
posted @ 2017-07-07 11:18 Annetree 阅读(430) 评论(0) 推荐(0)
PAT 乙级 1041. 考试座位号(15)
摘要:题目传送:https://www.patest.cn/contests/pat-b-practise/1041 每个PAT考生在参加考试时都会被分配两个座位号,一个是试机座位,一个是考试座位。正常情况下,考生在入场时先得到试机座位号码,入座进入试机状态后,系统会显示该考生的考试座位号码,考试时考生需 阅读全文
posted @ 2017-07-07 10:06 Annetree 阅读(229) 评论(0) 推荐(0)
PAT 乙级 1036. 跟奥巴马一起编程(15)
摘要:题目传送:https://www.patest.cn/contests/pat-b-practise/1036 美国总统奥巴马不仅呼吁所有人都学习编程,甚至以身作则编写代码,成为美国历史上首位编写计算机代码的总统。2014年底,为庆祝“计算机科学教育周”正式启动,奥巴马编写了很简单的计算机代码:在屏 阅读全文
posted @ 2017-07-07 09:56 Annetree 阅读(162) 评论(0) 推荐(0)
PAT乙级 1031. 查验身份证(15)
摘要:题目传送:https://www.patest.cn/contests/pat-b-practise/1031 一个合法的身份证号码由17位地区、日期编号和顺序编号加1位校验码组成。校验码的计算规则如下: 首先对前17位数字加权求和,权重分配为:{7,9,10,5,8,4,2,1,6,3,7,9,1 阅读全文
posted @ 2017-07-06 17:28 Annetree 阅读(201) 评论(0) 推荐(0)
PAT乙级 1026. 程序运行时间(15)
摘要:题目传送:https://www.patest.cn/contests/pat-b-practise/1026 要获得一个C语言程序的运行时间,常用的方法是调用头文件time.h,其中提供了clock()函数,可以捕捉从程序开始运行到clock()被调用时所耗费的时间。这个时间单位是clock ti 阅读全文
posted @ 2017-07-06 17:11 Annetree 阅读(162) 评论(0) 推荐(0)
PAT乙级 1021. 个位数统计 (15)
摘要:题目传送:https://www.patest.cn/contests/pat-b-practise/1021 给定一个k位整数N = dk-1*10k-1 + ... + d1*101 + d0 (0<=di<=9, i=0,...,k-1, dk-1>0),请编写程序统计每种不同的个位数字出现的 阅读全文
posted @ 2017-07-06 17:03 Annetree 阅读(114) 评论(0) 推荐(0)
PAT乙级 1016. 部分A+B (15)
摘要:题目传送:https://www.patest.cn/contests/pat-b-practise/1016 正整数A的“DA(为1位整数)部分”定义为由A中所有DA组成的新整数PA。例如:给定A = 3862767,DA = 6,则A的“6部分”PA是66,因为A中有2个6。 现给定A、DA、B 阅读全文
posted @ 2017-07-06 16:57 Annetree 阅读(199) 评论(0) 推荐(0)
PAT 乙级 1011. A+B和C (15)
摘要:题目传送:https://www.patest.cn/contests/pat-b-practise/1011 给定区间[-231, 231]内的3个整数A、B和C,请判断A+B是否大于C。 输入格式: 输入第1行给出正整数T(<=10),是测试用例的个数。随后给出T组测试用例,每组占一行,顺序给出 阅读全文
posted @ 2017-07-06 16:47 Annetree 阅读(208) 评论(0) 推荐(0)
poj 1026 Cipher(置换群)
摘要:Description Bob and Alice started to use a brand-new encoding scheme. Surprisingly it is not a Public Key Cryptosystem, but their encoding and decodin 阅读全文
posted @ 2017-07-06 16:25 Annetree 阅读(170) 评论(0) 推荐(0)
POJ 2369 Permutations(置换群概念题)
摘要:Description We remind that the permutation of some final set is a one-to-one mapping of the set onto itself. Less formally, that is a way to reorder e 阅读全文
posted @ 2017-07-05 17:07 Annetree 阅读(241) 评论(0) 推荐(0)
gcd和lcm模板
摘要:long long gcd(long long b,long long c)//计算最大公约数{ return c==0?b:gcd(c,b%c);} long long lcm(long long b,long long c)//计算最小公倍数{ return b * c/ gcd(b, c); 阅读全文
posted @ 2017-07-03 15:40 Annetree 阅读(328) 评论(0) 推荐(0)
HDU 1796 How many integers can you find(容斥原理)
摘要:题目传送:http://acm.hdu.edu.cn/diy/contest_showproblem.php?cid=20918&pid=1002 Problem Description Now you get a number N, and a M-integers set, you should 阅读全文
posted @ 2017-07-03 15:39 Annetree 阅读(159) 评论(0) 推荐(0)
HDU 2147 kiki's game(博弈经典题)
摘要:题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=2147 Problem Description Recently kiki has nothing to do. While she is bored, an idea appears in his mi 阅读全文
posted @ 2017-07-02 16:21 Annetree 阅读(148) 评论(0) 推荐(0)
HDU 1846 Brave Game(巴什博弈超简单题)
摘要:题目传送:http://acm.hdu.edu.cn/showproblem.php?pid=1846 Problem Description 十年前读大学的时候,中国每年都要从国外引进一些电影大片,其中有一部电影就叫《勇敢者的游戏》(英文名称:Zathura),一直到现在,我依然对于电影中的部分电 阅读全文
posted @ 2017-07-02 15:16 Annetree 阅读(207) 评论(0) 推荐(0)