文档介绍:A-Square Number
Time limit: 1000ms
Description
小明最近在学方数,是指可以写成某 个整数的平方的数。最小的5个完全平方数分别为0, 1, 4, 9, 16的深沉,你所不知道的是,程序猿们也爱铜锣烧。。。
一天在买铜锣烧的哆啦A梦遇到了令人棘手的问题:
排队买铜锣烧的人很多,哆啦A梦前有2N个程序猿,其中N个程序猿每人身上只有一张 5块钱,另外N个程序猿每人身上只有一张10块钱。铜锣烧5块一个。
开始时铜锣烧店老板身上没有钱,但这2N个程序猿都是一副闷骚的架势,互不沟通,每 人都准备买一个铜锣烧就走。
哆啦A梦为了能顺利地买到铜锣烧,必须让前面的程序猿在买铜锣烧时不会发生老板找 不开钱的情况。于是他决定使用“传送门”来达到将程序猿队伍重排的目的,重排后的队伍 能避免老板找不开钱的情况。但哆啦A梦实在是分辨不清这么多程序猿的面孔,毕竟都是 一副苦逼的样了...所以他只把程序猿分为带5块钱的和带10块钱的两种人,排队时亦是如 此。
但哆啦A梦毕竟不是程序猿,他想知道共有多少种排队方法能避免老板找不开钱的情况 出现???于是他找到了你,如果你能帮他解决这个问题,他便会帮你实现一个愿望~ 输入格式:
每个输入文件包含多组数据,以文末为结束标志。 每行一个整数N (l<=N<=5000) 输出格式:
对每组数据输出方案数除以20000014的余数,每个答案占一行
输入样例:
1
2
输出样例:
1
2
Hint:
对于两个队伍,如果持有钱的序列相同,则认为是同一种排队方法,否则为不同的。
如n = 2时有5元,10元,5元,10元; 和5元,5元,10元,10元这两种排队方法~
E-Sort
time limit: Is
Description
Given n different numbers, please sort them step by step.
On each step, you can only move one number to the *first* or *last* position.
How many steps at least to sort the n numbers in ascending order?
Input
Multi-line, n different numbers a line (n <= 10 5, 0 <= each number < 2 31).
Output
For each line, output the min steps to sort the n numbers.
Sample Input
3 5 17 6
Sample Output
2
F-DividingCoins
There are N pirates dividing M gold coins. They stand in a row and get number from 1 to n, thus proposing their dividing method one by one. For each pirate, if his method is surpported by more than Q%(0<=Q<100) of the pirates(including himself), the proposed method can be carried out. Otherwise, he will be throw into the sea to feed sharks.
All of the pirates are smart enough to maximize their own benefit and they prefer to throw others into the sea if the benefits are same.
Input:
N, M, Q
n<=10000, m<=1000000000
Output:
The max gold coins the No. 1 pirate can get. Output -1 if he have to die.
Sample input:
5 100 50
Sample output:
97
G-GetBallons
完成NKPC1O出题任务的Lingo同学长舒一口气,决定去仓库取10只不同颜色的气球犒劳犒 劳自己~ (为什么是10? NKPC10?网络赛10道题?还是 )
Lingo同学来到ACM协会的气球仓库,发现仓库库存十分充足,凡是在“16位加强色”(