SDAU训练日志第61篇(2019年4月13日)

今天因为身体不是很舒服,所以下午的比赛在宿舍单打的没去实验室。

前两题都以前刷过原题或者类似的,很顺的就A了,后两题有些马虎WA了几次,然后困得不行,躺了一会,起来肝了G。当我才5题的时候,发现18级的大佬们已经9题还差一个就AK了,心里不是滋味,菜是原罪,继续加油吧。

【STL/思维】King of Karaoke

题意:

It’s Karaoke time! DreamGrid is performing the song Powder Snow in the game King of Karaoke. The song performed by DreamGrid can be considered as an integer sequence , and the standard version of the song can be considered as another integer sequence . The score is the number of integers satisfying and .

As a good tuner, DreamGrid can choose an integer (can be positive, 0, or negative) as his tune and add to every element in . Can you help him maximize his score by choosing a proper tune?

Input
There are multiple test cases. The first line of the input contains an integer (about 100), indicating the number of test cases. For each test case:

The first line contains one integer (), indicating the length of the sequences and .

The second line contains integers (), indicating the song performed by DreamGrid.

The third line contains integers (), indicating the standard version of the song.

It’s guaranteed that at most 5 test cases have .

Output
For each test case output one line containing one integer, indicating the maximum possible score. 继续阅读【STL/思维】King of Karaoke

【set去重】矩阵中不重复的数

一个m*n的矩阵。
该矩阵的第一列是a^b,(a+1)^b,…..(a + n – 1)^b
第二列是a^(b+1),(a+1)^(b+1),…..(a + n – 1)^(b+1)
…….
第m列是a^(b + m – 1),(a+1)^(b + m – 1),…..(a + n – 1)^(b + m – 1)
(a^b表示a的b次方)
下面是一个4*4的矩阵:
2^2=4, 2^3=8, 2^4=16, 2^5=32
3^2=9, 3^3=27, 3^4=81, 3^5=243
4^2=16, 4^3=64, 4^4=256, 4^5=1024
5^2=25, 5^3=125, 5^4=625, 5^5=3125
问这个矩阵里有多少不重复的数(比如4^3 = 8^2,这样的话就有重复了)
2^2=4, 2^3=8, 2^4=16, 2^5=32
3^2=9, 3^3=27, 3^4=81, 3^5=243
4^2=16, 4^3=64, 4^4=256, 4^5=1024
m = 4, n = 3, a = 2, b = 2。其中2^4与4^2是重复的元素。 继续阅读【set去重】矩阵中不重复的数

【STL二分、打表】因子只包含2 3 5的数

51nod P1010
K的因子中只包含2 3 5。满足条件的前10个数是:2,3,4,5,6,8,9,10,12,15。
所有这样的K组成了一个序列S,现在给出一个数n,求S中 >= 给定数的最小的数。
例如:n = 13,S中 >= 13的最小的数是15,所以输出15。 继续阅读【STL二分、打表】因子只包含2 3 5的数