专题训练
大一专题训练
m0_46185124
这个作者很懒,什么都没留下…
展开
-
原创 寒假集训_专题五题解_G - Sliding Window
题目An array of size n ≤ 10 6 is given to you. There is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k numbers in the window. Each ...原创 2020-03-12 23:45:40 · 126 阅读 · 0 评论 -
寒假集训_专题五题解_D - I Hate It
题目很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0<N<=200000,0<M<500...转载 2020-03-12 23:45:32 · 152 阅读 · 0 评论 -
寒假集训_专题五题解_A - Stars
题目Astronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher a...原创 2020-03-13 00:11:56 · 544 阅读 · 0 评论 -
寒假集训_专题四题解_K - Co-prime
题目Given a number N, you are asked to count the number of integers between A and B inclusive which are relatively prime to N.Two integers are said to be co-prime or relatively prime if they have no c...原创 2020-01-25 20:27:07 · 118 阅读 · 0 评论 -
寒假集训_专题四题解_J - Sum (HDU - 4704 )
题目Input2Output2HintFor N = 2, S(1) = S(2) = 1.The input file consists of multiple test cases.Sample Input2题目大意定义S(k)为将N分成k份的和的方案数(有顺序,k份中不含0),求(S(1)+S(2)+…+S(N))mod109+7题解通过隔板法可求出S...原创 2020-01-25 20:20:25 · 151 阅读 · 0 评论 -
寒假集训_专题四题解_I - Saving Beans (HDU - 3037)
题目Although winter is far away, squirrels have to work day and night to save beans. They need plenty of food to get through those long cold days. After some time the squirrel family thinks that they h...原创 2020-01-25 20:06:05 · 209 阅读 · 0 评论 -
寒假集训_专题四题解_H - Prime Distance(POJ - 2689)
题目The branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians for thousands of years is the question of prim...原创 2020-01-23 23:31:47 · 226 阅读 · 0 评论 -
寒假集训_专题四题解_D - Beautiful Numbers
题目Vitaly is a very weird man. He’s got two favorite digits a and b. Vitaly calls a positive integer good, if the decimal representation of this integer only contains digits a and b. Vitaly calls a go...原创 2020-01-20 23:43:16 · 298 阅读 · 0 评论 -
寒假集训_专题三题解_K - 畅通工程再续
题目相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意...原创 2020-01-20 23:39:48 · 110 阅读 · 0 评论 -
寒假集训_专题三题解_L - Til the Cows Come Home
题目Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants to ge...原创 2020-01-20 21:06:16 · 141 阅读 · 0 评论 -
寒假集训_专题三题解_A - Cow Contest
题目N (1 ≤ N ≤ 100) cows, conveniently numbered 1…N, are participating in a programming contest. As we all know, some cows code better than others. Each cow has a certain constant skill rating that is ...原创 2020-01-16 20:58:00 · 499 阅读 · 0 评论 -
寒假集训_专题四题解_E - Revenge of GCD
题目In mathematics, the greatest common divisor (gcd), also known as the greatest common factor (gcf), highest common factor (hcf), or greatest common measure (gcm), of two or more integers (when at le...原创 2020-01-16 19:38:16 · 200 阅读 · 0 评论 -
寒假集训_专题四题解_F - 青蛙的约会
题目两只青蛙在网上相识了,它们聊得很开心,于是觉得很有必要见一面。它们很高兴地发现它们住在同一条纬度线上,于是它们约定各自朝西跳,直到碰面为止。可是它们出发之前忘记了一件很重要的事情,既没有问清楚对方的特征,也没有约定见面的具体位置。不过青蛙们都是很乐观的,它们觉得只要一直朝着某个方向跳下去,总能碰到对方的。但是除非这两只青蛙在同一时间跳到同一点上,不然是永远都不可能碰面的。为了帮助这两只乐观的...原创 2020-01-16 19:32:33 · 179 阅读 · 0 评论 -
寒假集训_专题四题解_G - 美素数
题目小明对数的研究比较热爱,一谈到数,脑子里就涌现出好多数的问题,今天,小明想考考你对素数的认识。 问题是这样的:一个十进制数,如果是素数,而且它的各位数字和也是素数,则称之为“美素数”,如29,本身是素数,而且2+9 = 11也是素数,所以它是美素数。 给定一个区间,你能计算出这个区间内有多少个美素数吗?Input第一行输入一个正整数T,表示总共有T组数据(T <= 1000...原创 2020-01-15 20:37:11 · 728 阅读 · 0 评论 -
寒假集训_专题一题解_B(POJ - 2386)
题目 Lake Counting Time Limit: 1000MS Memory Limit: 65536K DescriptionDue to recent rains, water has pooled in various places in Farmer John’s field, which is represented by a re...原创 2020-01-13 21:12:35 · 98 阅读 · 0 评论 -
寒假集训_专题一题解_C(POJ - 1979)
题目Red and BlackTime Limit: 1000MS Memory Limit: 30000KDescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black til...原创 2020-01-13 21:22:50 · 108 阅读 · 0 评论 -
寒假集训_专题一题解_D - DFS(HDU - 2660)
题目Accepted NecklaceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 KProblem DescriptionI have N precious stones, and plan to use K of them to make a necklace for my mother, but...原创 2020-01-13 21:32:28 · 107 阅读 · 0 评论 -
寒假集训_专题一题解_F - BFS (POJ - 1426)
题目Find The MultipleTime Limit: 1000MS Memory Limit: 10000KDescriptionGiven a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only t...原创 2020-01-13 21:42:33 · 85 阅读 · 0 评论 -
寒假集训_专题一题解_G - BFS (Gym - 101755H)
题目H. Safe Pathtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou play a new RPG. The world map in it is represented by a grid of n × m cell...原创 2020-01-13 22:01:41 · 100 阅读 · 0 评论 -
寒假集训_专题一题解_L - 二分??? (CodeForces - 1260B )
题目B. Obtain Two Zeroestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integers a and b. You may perform any number of opera...原创 2020-01-14 00:06:11 · 165 阅读 · 0 评论 -
寒假集训_专题一题解_I - 二分 (HYSBZ - 1734)
题目1734: [Usaco2005 feb]Aggressive cows 愤怒的牛DescriptionFarmer John has built a new long barn, with N (2 <= N <= 100,000) stalls. The stalls are located along a straight line at positions x1,…,...原创 2020-01-14 00:12:54 · 102 阅读 · 0 评论 -
寒假集训_专题二题解_A - CD (UVA - 624)
题目题目大意给你n件物品,每件物品有其容量且只有一件,求每件物品总和在不超过m时最大的容量,并输出解决方案题解若把每件物品的价值看作容量,那么本题显然是01背包问题,唯一不同的是需要输出解决方案,所以要额外开个数组,记录是由哪个状态转移而来。代码#include <iostream>using namespace std;const int N = 1e4 + 10...原创 2020-01-14 11:14:50 · 92 阅读 · 0 评论 -
寒假集训_专题二题解_B - Coins (POJ - 1742)
题目CoinsTime Limit: 3000MS Memory Limit: 30000KTotal Submissions: 49288 Accepted: 16535DescriptionPeople in Silverland use coins.They have coins of value A1,A2,A3…An Silverland dollar.One day To...原创 2020-01-14 11:15:18 · 159 阅读 · 0 评论 -
寒假集训_专题二题解_C - Piggy-Bank (HDU - 1114)
题目Piggy-BankTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 44460 Accepted Submission(s): 21943Problem DescriptionBefore ACM can do anyt...原创 2020-01-14 12:01:43 · 324 阅读 · 0 评论 -
寒假集训_专题三题解_H - 畅通工程
题目某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇。省政府“畅通工程”的目标是使全省任何两个城镇间都可以实现交通(但不一定有直接的道路相连,只要互相间接通过道路可达即可)。问最少还需要建设多少条道路?Input测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是城镇数目N ( < 1000 )和道路数目M;随后的M行对应M条道路,每行给出...原创 2020-01-14 20:34:13 · 116 阅读 · 0 评论 -
寒假集训_专题三题解_B - 最短路
题目在每年的校赛里,所有进入决赛的同学都会获得一件很漂亮的t-shirt。但是每当我们的工作人员把上百件的衣服从商店运回到赛场的时候,却是非常累的!所以现在他们想要寻找最短的从商店到赛场的路线,你可以帮助他们吗?Input输入包括多组数据。每组数据第一行是两个整数N、M(N<=100,M<=10000),N表示成都的大街上有几个路口,标号为1的路口是商店所在地,标号为N的路口是赛...原创 2020-01-14 21:03:14 · 79 阅读 · 0 评论 -
寒假集训_专题三题解_J - 畅通工程续
题目某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。Input本题目包含多组数据,请处理到文件结束。每组数据第一行包含两个正整数N和M(0<N<200,0<...原创 2020-01-14 22:29:55 · 263 阅读 · 0 评论 -
寒假集训_专题三题解_C - 六度分离
题目1967年,美国著名的社会学家斯坦利·米尔格兰姆提出了一个名为“小世界现象(small world phenomenon)”的著名假说,大意是说,任何2个素不相识的人中间最多只隔着6个人,即只用6个人就可以将他们联系在一起,因此他的理论也被称为“六度分离”理论(six degrees of separation)。虽然米尔格兰姆的理论屡屡应验,一直也有很多社会学家对其兴趣浓厚,但是在30多年...原创 2020-01-15 09:38:37 · 372 阅读 · 0 评论 -
寒假集训_专题四题解_A - k-rounding
题目For a given positive integer n denote its k-rounding as the minimum positive integer x, such that x ends with k or more zeros in base 10 and is divisible by n.For example, 4-rounding of 375 is 375...原创 2020-01-15 11:47:42 · 215 阅读 · 0 评论 -
寒假集训_专题四题解_B - Fedya and Maths
题目Fedya studies in a gymnasium. Fedya’s maths hometask is to calculate the following expression:(1n + 2n + 3n + 4n) mod 5for given value of n. Fedya managed to complete the task. Can you? Note that...原创 2020-01-15 11:51:00 · 277 阅读 · 0 评论 -
寒假集训_专题一题解_A(POJ 3061)
寒假集训_专题一题解_A(POJ 3061)题目Time Limit: 1000MS Memory Limit: 65536KDescriptionA sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer...原创 2020-01-13 19:12:32 · 171 阅读 · 0 评论 -
寒假集训_专题四题解_B - A Simple Problem with Integers
题目You have N integers, A1, A2, … , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the...原创 2020-03-12 23:41:10 · 116 阅读 · 0 评论