
常用技巧——打表&规律
Alex_McAvoy
想要成为渔夫的猎手
展开
-
Ekka Dokka(LightOJ-1116)
Problem DescriptionEkka and his friend Dokka decided to buy a cake. They both love cakes and that's why they want to share the cake after buying it. As the name suggested that Ekka is very fond of ...原创 2019-02-13 23:29:27 · 373 阅读 · 0 评论 -
Knights in Chessboard(LightOJ-1010)
Problem DescriptionGiven an m x n chessboard where you want to place chess knights. You have to find the number of maximum knights that can be placed in the chessboard such that no two knights atta...原创 2019-03-22 17:29:29 · 727 阅读 · 0 评论 -
Margarite and the best present(CF-1080B)
Problem DescriptionLittle girl Margarita is a big fan of competitive programming. She especially loves problems about arrays and queries on them.Recently, she was presented with an array aa of th...原创 2018-12-04 17:40:57 · 288 阅读 · 0 评论 -
0和5(51Nod-1433)
题目小K手中有n张牌,每张牌上有一个一位数的数,这个字数不是0就是5。小K从这些牌在抽出任意张(不能抽0张),排成一行这样就组成了一个数。使得这个数尽可能大,而且可以被90整除。注意:1.这个数没有前导0,2.小K不需要使用所有的牌。输入每个测试数据输入共2行。第一行给出一个n,表示n张牌。(1<=n<=1000)第二行给出n个整数a[0],a[1],a[...原创 2019-04-25 09:37:43 · 561 阅读 · 0 评论 -
Sonya and Exhibition(CF-1004B)
Problem DescriptionSonya decided to organize an exhibition of flowers. Since the girl likes only roses and lilies, she decided that only these two kinds of flowers should be in this exhibition.Th...原创 2018-08-26 16:12:45 · 276 阅读 · 0 评论 -
处女座和小姐姐
【题目描述】既然昨天晚上处女座已经训练了,明天才要交作业,那今天就是平淡无奇要上课的一天了。然而处女座也想自己的小姐姐了,可是这节课是老师安排座位,处女座坐在(1,1),而小姐姐坐在(n,m)。他们之间只能通过传纸条的方式来交流感情。对于处女座而言,他上课不想过度分心,因此并不想传纸条,只在那里趁机折千纸鹤。老师上课喜欢用"开火车"的方式让大家轮流回答问题,显然处女座作为(1,1)位...原创 2019-01-26 21:58:22 · 573 阅读 · 0 评论 -
Positive Negative Sign(LightOJ-1294)
Problem DescriptionGiven two integers: n and m and n is divisible by 2m, you have to write down the first n natural numbers in the following form. At first take first m integers and make their sign...原创 2019-02-13 23:26:47 · 298 阅读 · 0 评论 -
Fibsieve`s Fantabulous Birthday(LightOJ-1008)
Problem DescriptionFibsieve had a fantabulous (yes, it's an actual word) birthday party this year. He had so many gifts that he was actually thinking of not having a party next year.Among these g...原创 2019-01-22 16:49:54 · 611 阅读 · 0 评论 -
常用技巧 —— 打表&规律
【概述】找规律是一种常见的题型,当给出相关数据后,我们往往可以利用打表的方法,得到大量的数据,然后再寻找规律。简单来说,打表就是需要对某个范围内的数据进行判断,判断它是否符合某种条件,然后在接下来的很多次数据中,可能会反复使用到这些判断的结果,为了减少重复计算,可以事先将某个范围的数据的判断结果全都计算并保存起来,当需要再使用到的时候,直接使用即可。打表实际上是一种思维方法,被广泛的应...原创 2019-08-07 11:31:10 · 1756 阅读 · 0 评论 -
Pyramid (Gym -01981G)
Problem DescriptionThe use of the triangle in the New Age practices seems to be very important as it represents the unholytrinity (Satan, the Antichrist and the False Prophet bringing mankind to t...原创 2019-08-20 18:21:04 · 339 阅读 · 0 评论 -
Seq(HDU-6672)
Problem Description度度熊有一个递推式其中 a1=1。现给出 n,需要求 an。Input第一行输入一个整数T,代表T(1≤T≤100000) 组数据。接下T行,每行一个数字 n(1≤n≤1012)。Output输出 T 行,每行一个整数表示答案。Sample Input512345Sample Output1...原创 2019-08-19 09:56:04 · 221 阅读 · 0 评论 -
Roman Digits(CF-998D)
Problem DescriptionLet's introduce a number system which is based on a roman digits. There are digits I, V, X, L which correspond to the numbers 1, 5, 10 and 50 respectively. The use of other roman...原创 2018-08-26 16:35:40 · 410 阅读 · 0 评论 -
生活大爆炸版石头剪刀布(洛谷-P1328)
题目描述石头剪刀布是常见的猜拳游戏:石头胜剪刀,剪刀胜布,布胜石头。如果两个人出拳一样,则不分胜负。在《生活大爆炸》第二季第8 集中出现了一种石头剪刀布的升级版游戏。升级版游戏在传统的石头剪刀布游戏的基础上,增加了两个新手势:斯波克:《星际迷航》主角之一。蜥蜴人:《星际迷航》中的反面角色。这五种手势的胜负关系如表一所示,表中列出的是甲对乙的游戏结果。现在,小A 和小B...原创 2018-04-03 17:31:05 · 1960 阅读 · 0 评论 -
A Cubic number and A Cubic Number(HDU-6216)
Problem DescriptionA cubic number is the result of using a whole number in a multiplication three times. For example, 3×3×3=27 so 27 is a cubic number. The first few cubic numbers are 1,8,27,64 and...原创 2019-02-15 18:53:18 · 314 阅读 · 0 评论 -
序列中最大的数(51Nod-1062)
题目有这样一个序列a:a[0] = 0a[1] = 1a[2i] = a[i]a[2i+1] = a[i] + a[i+1]输入一个数N,求a[0] - a[n]中最大的数。a[0] = 0, a[1] = 1, a[2] = 1, a[3] = 2, a[4] = 1, a[5] = 3, a[6] = 2, a[7] = 3, a[8] = 1, a[9] = 4, a[1...原创 2019-04-15 21:31:15 · 544 阅读 · 0 评论 -
求递推序列的第N项(51Nod-1126)
题目有一个序列是这样定义的:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.给出A,B和N,求f(n)的值。输入输入3个数:A,B,N。数字之间用空格分割。(-10000 <= A, B <= 10000, 1 <= N <= 10^9)输出输出f(n)的值。输入样例...原创 2019-04-17 20:31:04 · 469 阅读 · 2 评论 -
小b和灯泡(51Nod-2489)
题目小b有n个关闭的灯泡,编号为1...n。小b会进行n轮操作,第i轮她会将编号为i的倍数的灯泡的开关状态取反,即开变成关,关变成开。求n轮操作后,有多少灯泡是亮着的。输入输入一个数字表示灯泡数n,其中1<n≤10000000输出输出一个数字表示最终亮着的灯泡数输入样例3输出样例1思路:实质是求 1~n 中每个数因子的个数,那么我们对 1~n...原创 2019-04-26 20:41:37 · 545 阅读 · 0 评论 -
迎春舞会之数字舞蹈(洛谷-P1538)
题目描述在越来越讲究合作的时代,人们注意的更多的不是个人物的舞姿,而是集体的排列。为了配合每年的倒计时,同学们决定排出——“数字舞蹈”。顾名思义就是所有人一起排成若干个数字 -\_\_\_-|||| 更为创新的是,每个人都是趴在地上,保证横竖。现在给出数字及其要求摆出的大小,请你编程,模拟同学们的优美姿态。输入输出格式输入格式:第一行为k。k表示要摆出数字的大小。第...原创 2018-04-11 23:43:07 · 1013 阅读 · 0 评论 -
permutation 2(HDU-6630)
Problem DescriptionYou are given three positive integers N,x,y.Please calculate how many permutations of 1∼N satisfies the following conditions (We denote the i-th number of a permutation by pi):...原创 2019-10-08 15:02:50 · 217 阅读 · 0 评论