思维
Baiyi_destroyer
萌新求关注^_^
展开
-
烤面包片(CCPC-Wannafly & Comet OJ 夏季欢乐赛(2019) C)
题目描述鸡尾酒最喜欢吃东北的烤面包片了。每次到东北地区的区域赛或者是秦皇岛的wannafly camp,鸡尾酒都会吃很多的烤面包片,即使比赛打铁也觉得不枉此行。“我想吃烤面包片!!!”这不,半年没吃烤面包片的鸡尾酒看到大家都聚集在秦皇岛参加暑假camp,羡慕地发出了想要的声音。当鸡尾酒“想要”的时候,他说的话会带三个感叹号来表示非常“想要”。至于有多“想要”,他给了你一个算式让你来体会...原创 2019-07-29 08:32:57 · 234 阅读 · 0 评论 -
Sequence Transformation(CodeForces 1059C)
DescriptionLet's call the following process a transformation of a sequence of length nn.If the sequence is empty, the process ends. Otherwise, append the greatest common divisor (GCD) of all the e...原创 2018-10-06 16:45:58 · 321 阅读 · 0 评论 -
Memory and De-Evolution(CodeForces 712C)
DescriptionMemory is now interested in the de-evolution of objects, specifically triangles. He starts with an equilateral triangle of side lengthx, and he wishes to perform operations to obtain an ...原创 2018-10-06 14:03:32 · 156 阅读 · 0 评论 -
游起来吧!超妹!
Description 夏天到了,无聊的超妹跑到了落雪湖里抓鱼吃。结果,游到湖的正中央时被湖边保安看到了,保安要抓住超妹。我们假设落雪湖是一个半径为r的圆形,超妹在圆形的正中心,速度为1.保安由于不会游泳所以只能沿着湖的边缘奔跑,速度为n.因为超妹在陆地上的速度是很快的,所以我们假设只要超妹到达岸边就能顺利溜走。假设两人都足够聪明,且体力无限。 Input 输入包含T组...原创 2018-09-27 20:52:21 · 170 阅读 · 0 评论 -
Karen and Coffee(CodeForces 816B)
DescriptionTo stay woke and attentive during classes, Karen needs some coffee!Karen, a coffee aficionado, wants to know the optimal temperature for brewing the perfect cup of coffee. Indeed, she...原创 2018-10-04 22:38:52 · 234 阅读 · 0 评论 -
Array Product(CodeForces - 1042C )
You are given an array aa consisting of nn integers. You can perform the following operations with it:Choose some positions i and j (1≤i,j≤n,i≠j), write the value of ai⋅aj into the j-th cell and rem...原创 2018-10-03 18:20:06 · 442 阅读 · 0 评论 -
Vitamins(CodeForces - 1042B )
Berland shop sells nn kinds of juices. Each juice has its price cici. Each juice includes some set of vitamins in it. There are three types of vitamins: vitamin "A", vitamin "B" and vitamin "C". Each ...原创 2018-10-03 18:14:04 · 392 阅读 · 0 评论 -
Pythagorean Triples(CodeForces 707C)
Katya studies in a fifth grade. Recently her class studied right triangles and the Pythagorean theorem. It appeared, that there are triples of positive integers such that you can construct a right tri...原创 2018-09-21 00:12:32 · 188 阅读 · 0 评论 -
Shashlik Cooking(CodeForces - 1040B)
Long story short, shashlik is Miroslav's favorite food. Shashlik is prepared on several skewers simultaneously. There are two states for each skewer: initial and turned over.This time Miroslav laid ...原创 2018-10-02 17:25:23 · 331 阅读 · 0 评论 -
Minimum Ternary String (CodeForces - 1009B)
You are given a ternary string (it is a string which consists only of characters '0', '1' and '2').You can swap any two adjacent (consecutive) characters '0' and '1' (i.e. replace "01" with "10" or ...原创 2018-10-01 17:51:14 · 205 阅读 · 0 评论 -
Equal Sum Partitions(UVALive 4553,模拟)
DescriptionAn equal sum partition of a sequence of numbers is a grouping of the numbers (in the same order as the original sequence) in such a way that each group has the same sum. For example, the...原创 2018-10-14 14:49:19 · 241 阅读 · 0 评论 -
The Next Permutation(UVALive 4556,模拟)
DescriptionFor this problem, you will write a program that takes a (possibly long) string of decimal digits, and outputs the permutation of those decimal digits that has the next larger value (as a...原创 2018-10-14 15:43:51 · 132 阅读 · 0 评论 -
米勒拉宾算法(素性测试)
米勒拉宾素性测试对于一个数n,如果想要判断它是否为素数,常规的方法为试除法。即,让n依次除以2到sqrt(n)以内的整数。如果有出现除尽的情况,则为合数。该方法的时间复杂度为O(sqrt(n))在面对n为长整型的时候有可能超出时间要求。因此普遍采用米勒拉宾算法进行素性判定。在此之前介绍一种伪素数判定方法——小费马定理。小费马定理为:若有素数p,则对任意的数a( a为正整数 ,且a &...转载 2018-11-15 20:40:28 · 2552 阅读 · 0 评论 -
超级无敌简单题(广东工业大学第十四届程序设计竞赛1003)
Description通常来说,题面短的题目一般都比较难,所以我要把题面写得很长很长。通常来说,题面短的题目一般都比较难,所以我要把题面写得很长很长。通常来说,题面短的题目一般都比较难,所以我要把题面写得很长很长。鸽子数字由以下过程定义:从任何正整数开始,将数字替换为其各个数位的平方和,并重复该过程,直到该数字等于1。如果不能,则这个数字不是鸽子数。例如7是鸽子数,因为7->49...原创 2019-03-16 23:37:45 · 433 阅读 · 0 评论 -
Pagodas
Descriptionn pagodas were standing erect in Hong Jue Si between the Niushou Mountain and the Yuntai Mountain, labelled from 1 to n. However, only two of them (labelled a and b, where 1 ≤ a ̸= b ≤ n)...原创 2019-02-25 10:02:48 · 462 阅读 · 0 评论 -
Dancing Stars on Me(UVALive 7189)
DescriptionThe sky was brushed clean by the wind and the stars were cold in a black sky. What a wonderful night. You observed that, sometimes the stars can form a regular polygon in the sky if we co...原创 2019-02-02 20:35:30 · 266 阅读 · 0 评论 -
House Building(UVALive 7194)
DescriptionHave you ever played the video game named Minecraft? This game has been one of the world’s most popular game in recent years. The world of Minecraft is made up of lots of 1×1×1 blocks in ...原创 2019-02-02 20:23:06 · 339 阅读 · 0 评论 -
Almost Sorted Array(UVALive 7188)
DescriptionWe are all familiar with sorting algorithms: quick sort, merge sort, heap sort, insertion sort, selectionsort, bubble sort, etc. But sometimes it is an overkill to use these algorithms f...原创 2019-02-02 20:15:33 · 296 阅读 · 0 评论 -
Present Problem(UVALive 7000)
DescriptionA group of persons (indexed from 0 to n − 1) play a game to determine which of the n presents (alsoindexed from 0 to n − 1) each of them will get. They play the game on a system of n ver...原创 2019-02-02 19:40:49 · 390 阅读 · 0 评论 -
Little Sub and Pascal's Triangle(zoj月赛)
DescriptionLittle Sub is about to take a math exam at school. As he is very confident, he believes there is no need for a review.Little Sub’s father, Mr.Potato, is nervous about Little Sub’s attitud...原创 2019-01-21 22:00:28 · 408 阅读 · 0 评论 -
Divisor Subtraction(CodeForces 1076B)
DescriptionYou are given an integer number nn. The following algorithm is applied to it:if n=0, then end algorithm; find the smallest prime divisor d of n; subtract dd from nn and go to step 1....原创 2018-12-25 10:34:11 · 394 阅读 · 0 评论 -
Refract Facts(UVALive 7292)
DescriptionA submarine is using a communications laser to send a message to a jet cruising overhead. The sea surface is flat. The submarine is cruising at a depth d below the surface. The jet is at ...原创 2018-11-18 00:19:10 · 230 阅读 · 0 评论 -
Factorials 阶乘
DescriptionN的阶乘写作N!表示小于等于N的所有正整数的乘积。阶乘会很快的变大,如13!就必须用32位整数类型来存储,70!即使用浮点数也存不下了。你的任务是找到阶乘最后面的非零位。举个例子,5!=1*2*3*4*5=120所以5!的最后面的非零位是2,7!=1*2*3*4*5*6*7=5040,所以最后面的非零位是4。Input共一行,一个整数不大于4,220的整数N。...原创 2018-09-02 13:10:11 · 663 阅读 · 0 评论 -
Factorial
DescriptionThe most important part of a GSM network is so called Base Transceiver Station (BTS). These transceivers form the areas called cells (this term gave the name to the cellular phone) and ev...原创 2018-09-02 13:06:45 · 207 阅读 · 0 评论 -
Divide by three, multiply by two(cf 977D)
DescriptionPolycarp likes to play with numbers. He takes some integer number xx, writes it down on the board, and then performs with it n−1n−1 operations of the two kinds:divide the number xx by 33 (x...原创 2018-06-22 20:19:38 · 289 阅读 · 0 评论 -
D - Different Sums URAL - 2065
DescriptionAlex is a very serious mathematician and he likes to solve serious problems. For example, this problem.You are to construct an array of n integers in which the amount of different integers ...原创 2018-04-29 21:26:55 · 159 阅读 · 0 评论 -
猴子分桃
Description老猴子辛苦了一辈子,给那群小猴子们留下了一笔巨大的财富——一大堆桃子。老猴子决定把这些桃子分给小猴子。第一个猴子来了,它把桃子分成五堆,五堆一样多,但还多出一个。它把剩下的一个留给老猴子,自己拿走其中的一堆。第二个猴子来了,它把桃子分成五堆,五堆一样多,但又多出一个。它把多出的一个留给老猴子,自己拿走其中的一堆。 后来的小猴子都如此照办。最后剩下的桃子全部留给老猴子。 这里有...转载 2018-05-03 21:03:37 · 288 阅读 · 0 评论 -
Sigma Function Input
DescriptionSigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes the sum of all divisors of a number. For example σ(24...转载 2018-04-19 19:44:25 · 301 阅读 · 0 评论 -
Deposits(ACM ICPC 2008–2009, NEERC, Northern Subregional Contest Problem D)
Input file: deposits.inOutput file: deposits.outTime limit: 3 secondsMemory limit: 256 megabytesDescriptionFinancial crisis forced many central banks deposit large amounts of cash to accounts of inves...原创 2018-04-23 15:06:46 · 312 阅读 · 0 评论 -
Class(ACM ICPC 2008–2009, NEERC, Northern Subregional Contest Problem C)
Input file: class.inOutput file: class.outTime limit: 3 secondsMemory limit: 256 megabytesDescriptionDr. Strange is a really strange lecturer. Each lecture he calculates class fullness and if it is sm...原创 2018-04-23 14:54:45 · 258 阅读 · 0 评论 -
Light Bulb(三分/推公式)
DescriptionCompared to wildleopard's wealthiness, his brother mildleopard is rather poor. His house is narrow and he has only one light bulb in his house. Every night, he is wandering in his incommo...原创 2018-03-27 20:09:49 · 353 阅读 · 0 评论 -
Tell me the area(思维题)
Problem Description There are two circles in the plane (shown in the below picture), there is a common area between the two circles. The problem is easy that you just tell me the common area. Input...原创 2018-03-27 19:31:16 · 201 阅读 · 0 评论 -
Exams(思维题)
DescriptionOne day the Codeforces round author sat exams. He had n exams and he needed to get an integer from 2 to 5 for each exam. He will have to re-sit each failed exam, i.e. the exam that gets mar...原创 2018-03-28 21:59:49 · 298 阅读 · 0 评论 -
Lecture Sleep(cf 961B)
DescriptionYour friend Mishka and you attend a calculus lecture. Lecture lasts n minutes. Lecturer tells ai theorems during the i-th minute.Mishka is really interested in calculus, though it is so har...原创 2018-06-22 20:35:55 · 184 阅读 · 0 评论 -
Switches and Lamps(cf 985B)
DescriptionYou are given n switches and m lamps. The i-th switch turns on some subset of the lamps. This information is given as the matrix aconsisting of n rows and m columns where ai, j = 1 if the i...原创 2018-06-25 16:43:39 · 277 阅读 · 0 评论 -
离散化的思想和它的两种代码与区别
离散化是什么:一些数字,他们的范围很大(0-1e9),但是个数不算多(1-1e5),并且这些数本身的数字大小不重要,重要的是这些数字之间的相对大小(比如说某个数字是这些数字中的第几小,而与这个数字本身大小没有关系,要的是相对大小)(6 8 9 4 离散化后即为 2 3 4 1)(要理解相对大小的意思)(6在这4个数字中排第二小,那么就把6离散化成2,与数字6本身没有关系, 8,9,4亦是如此)(2...转载 2018-07-17 15:42:13 · 332 阅读 · 0 评论 -
Subset Sums
Description对于从1到N的连续整集合合,能划分成两个子集合,且保证每个集合的数字和是相等的。 举个例子,如果N=3,对于{1,2,3}能划分成两个子集合,他们每个的所有数字和是相等的: {3} and {1,2} 这是唯一一种分发(交换集合位置被认为是同一种划分方案,因此不会增加划分方案总数) 如果N=7,有四种方法能划分集合{1,2,3,4,5,6,7},每一种分发的子集合各数字和...原创 2018-09-07 20:35:07 · 195 阅读 · 0 评论 -
Coloring a Tree(Codeforces 902 B)
DescriptionYou are given a rooted tree with n vertices. The vertices are numbered from 1 to n, the root is the vertex number 1.Each vertex has a color, let's denote the color of vertex v by cv. In...原创 2018-08-13 00:38:00 · 239 阅读 · 0 评论 -
Segments(CodeForces 909B )
DescriptionYou are given an integer N. Consider all possible segments on the coordinate axis with endpoints at integer points with coordinates between 0 and N, inclusive; there will be of them.Yo...原创 2018-08-12 16:07:47 · 338 阅读 · 0 评论 -
离散化的思想和它的两种代码与区别
离散化是什么:一些数字,他们的范围很大(0-1e9),但是个数不算多(1-1e5),并且这些数本身的数字大小不重要,重要的是这些数字之间的相对大小(比如说某个数字是这些数字中的第几小,而与这个数字本身大小没有关系,要的是相对大小)(6 8 9 4 离散化后即为 2 3 4 1)(要理解相对大小的意思)(6在这4个数字中排第二小,那么就把6离散化成2,与数字6本身没有关系, 8,9,4亦是如此)(2...转载 2018-08-01 16:47:11 · 256 阅读 · 1 评论