- 博客(85)
- 收藏
- 关注
原创 A Funny Game
A Funny GameDescriptionAlice and Bob decide to play a funny game. At the beginning of the game they pick n(1 <= n <= 10 6) coins in a circle, as Figure 1 shows. A move consists in removing o...
2018-02-25 16:09:34 240
原创 Red and Black
Red and BlackDescription There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of...
2018-02-25 15:56:26 208
原创 Shopping
ShoppingDescription Every girl likes shopping,so does dandelion.Now she finds the shop is increasing the price every day because the Spring Festival is coming .She is fond of a shop which is c...
2018-02-25 15:21:38 647
原创 Conan and Agasa play a Card Game
Codeforce914B (Conan and Agasa play a Card Game)DescriptionEdogawa Conan got tired of solving cases, and invited his friend, Professor Agasa, over. They decided to play a game of cards. Conan has ...
2018-02-25 02:47:54 555
原创 Red and Black
Red and BlackDescription There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of...
2018-02-25 02:30:23 189
原创 Graveyard Design
Graveyard DesignDescriptionKing George has recently decided that he would like to have a new design for the royal graveyard. The graveyard must consist of several sections, each of which must be a...
2018-02-25 02:14:13 213
原创 最大的位或
最大的位或Description B君和G君聊天的时候想到了如下的问题。 给定自然数l和r ,选取2个整数x,y满足l <= x <= y <= r ,使得x|y最大。 其中|表示按位或,即C、 C++、 Java中的|运算。 Input 包含至多10001组测试数据。 第一行有一个正整数,表示数据的组数。 接...
2018-02-25 01:22:45 329
原创 七夕节
七夕节Description 七夕节那天,月老来到数字王国,他在城门上贴了一张告示,并且和数字王国的人们说:”你们想知道你们的另一半是谁吗?那就按照告示上的方法去找吧!” 人们纷纷来到告示前,都想知道谁才是自己的另一半.告示如下: 数字N的因子就是所有比N小又能被N整除的所有正整数,如12的因子有1,2,3,4,6. 你想知道你的另一半吗?Input ...
2018-02-24 21:50:59 237
原创 丢手绢
丢手绢Description 六一儿童节到了,小朋友们在玩丢手绢的游戏。总共有C个小朋友,编号从1到C,他们站成一个圈,第i(1#include<iostream>using namespace std;int sim(int k,int m);int main(){ int k,ans[14]; for(int i=1;i<=14...
2018-02-24 18:59:21 467
原创 mode
modeDescription 给你一个n个数的数列,其中某个数出现了超过n div 2次即众数,请你找出那个数。Input第1行一个正整数n。 第2行n个正整数用空格隔开。Output一行一个正整数表示那个众数。Sample Input 5 3 2 3 1 3Sample Output 3 Hint100%的数据...
2018-02-24 18:46:10 180
原创 Chess
ChessDescription 車是中国象棋中的一种棋子,它能攻击同一行或同一列中没有其他棋子阻隔的棋子。一天,小度在棋盘上摆起了许多車……他想知道,在一共N×M个点的矩形棋盘中摆最多个数的車使其互不攻击的方案数。他经过思考,得出了答案。但他仍不满足,想增加一个条件:对于任何一个車A,如果有其他一个車B在它的上方(車B行号小于車A),那么車A必须在車B的右边(車A列号大于車B)。...
2018-02-24 18:23:55 390 2
原创 小C的倍数问题
小C的倍数问题Description 根据小学数学的知识,我们知道一个正整数x是3的倍数的条件是x每一位加起来的和是3的倍数。反之,如果一个数每一位加起来是3的倍数,则这个数肯定是3的倍数。现在给定进制P,求有多少个B满足P进制下,一个正整数是B的倍数的充分必要条件是每一位加起来的和是B的倍数。 Input 第一行一个正整数T表示数据组数(1<=T<=...
2018-02-24 17:10:08 247
原创 小学生的游戏
小学生的游戏Description某天,无聊的小斌叫上几个同学玩游戏,其中有比较笨的小兴,比较傻的小雪,可爱的小霞和自以为是的小楠。他们去找聪明的小明去给他们当裁判。判定谁取得游戏胜利。而这个游戏是由小斌想个1到10000000的数字让大家猜,看谁先猜中。为了防止小斌作弊,小明记录下了游戏的整个过程。你的任务是判断小斌是否有作弊。Input输入数据包括多盘游戏。一次猜数包含两行...
2018-02-24 16:28:32 290
原创 欧拉回路
欧拉回路Description 欧拉回路是指不令笔离开纸面,可画过图中每条边仅一次,且可以回到起点的一条回路。现给定一个图,问是否存在欧拉回路? Input 测试输入包含若干测试用例。每个测试用例的第1行给出两个正整数,分别是节点数N ( 1 < N < 1000 )和边数M;随后的M行对应M条边,每行给出一对正整数,分别是该条边直接连通的两个节点的编号(...
2018-02-24 16:16:56 242
原创 四边形分割平面
四边形分割平面Description 用N个四边方形最多可以把平面分成几个区域?Input 第一行输入一个整数T,表示数据组数(1<=T<=10000); 第二行输入一个正整数n(1<=n<=1000);Output 对于每组数据,请输出结果。Sample Input212Sample Output2...
2018-02-24 13:12:15 683
原创 连续整数的和
连续整数的和Description 给出一个正整数N,将N写为若干个连续数字和的形式(长度 >= 2)。例如N = 15,可以写为1 + 2 + 3 + 4 + 5,也可以写为4 + 5 + 6,或7 + 8。如果不能写为若干个连续整数的和,则输出No Solution。Input 输入1个数N(3 <= N <= 10^9)。Output ...
2018-02-24 12:56:46 5415
原创 距离之和最小
距离之和最小Description X轴上有N个点,求X轴上一点使它到这N个点的距离之和最小,输出这个最小的距离之和。Input 第1行:点的数量N。(2 <= N <= 10000) 第2 - N + 1行:点的位置。(-10^9 <= Pii <= 10^9)Output 输出最小距离之和Sample Input...
2018-02-24 11:44:51 4706
原创 水仙花数
水仙花数Description 水仙花数是指一个 n 位数 ( n >= 3 ),它的每个位上的数字的 n 次幂之和等于它本身。(例如:1^3 + 5^3 + 3^3 = 153) 给出一个整数M,求 >= M的最小的水仙花数。Input 一个整数M(10 <= M <= 1000)Output 输出>= M的最小...
2018-02-24 11:28:31 435
原创 滑雪
滑雪DescriptionMichael喜欢滑雪百这并不奇怪,因为滑雪的确很刺激。可是为了获得速度,滑的区域必须向下倾斜,而且当你滑到坡底,你不得不再次走上坡或者等待升降机来载你。Michael想知道载一个区域中最长底滑坡。区域由一个二维数组给出。数组的每个数字代表点的高度。下面是一个例子1 2 3 4 516 17 18 19 615 24 25 20 714 23...
2018-02-24 11:09:27 579
原创 Monkey and Banana
Monkey and BananaDescription A group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the...
2018-02-24 10:21:59 205
原创 Common Subsequence
Common SubsequenceDescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, …, xm > another sequence Z = ...
2018-02-24 09:23:08 119
原创 Charm Bracelet0-1背包
Charm Bracelet0-1背包DescriptionBessie has gone to the mall’s jewelry store and spies a charm bracelet. Of course, she’d like to fill it with the best charms possible from the N (1 ≤ N ≤ 3,402) avai...
2018-02-24 01:43:03 111
原创 River Hopscotch
River HopscotchDescriptionEvery year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The excitement takes place on a ...
2018-02-23 23:21:03 121
原创 Monthly Expense
Monthly ExpenseDescriptionFarmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of mone...
2018-02-23 17:12:34 702
原创 Pie
PieDescription My birthday is coming up and traditionally I’m serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are coming to...
2018-02-23 16:46:38 550
原创 Stall Reservations
Stall ReservationsDescriptionOh those picky N (1 <= N <= 50,000) cows! They are so picky that each one will only be milked over some precise time interval A..B (1 <= A <= B <= 1,000...
2018-02-23 09:44:38 131
原创 Anagrams by Stack
Anagrams by StackDescription How can anagrams result from sequences of stack operations? There are two sequences of stack operators which can convert TROT to TORT:[i i i i o o o oi o i i o...
2018-02-23 01:08:48 334
原创 Prime RingProblem
Prime RingProblemDescription A ring is compose of n circles as shown in diagram. Put natural number 1, 2, …, n into each circle separately, and the sum of numbers in two adjacent circles shoul...
2018-02-20 19:37:48 179
原创 Sequence(贪心+优先队列)
SequenceDescriptionGiven m sequences, each contains n non-negative integer. Now we may select one number from each sequence to form a sequence with m integers. It’s clear that we may get n ^ m thi...
2018-02-19 18:46:15 750
原创 钉子和小球
钉子和小球Describe有一个三角形木板,竖直立放,上面钉着n(n+1)/2颗钉子,还有(n+1)个格子(当n=5时如图1)。每颗钉子和周围的钉子的距离都等于d,每个格子的宽度也都等于d,且除了最左端和最右端的格子外每个格子都正对着最下面一排钉子的间隙。 让一个直径略小于d的小球中心正对着最上面的钉子在板上自由滚落,小球每碰到一个钉子都可能落向左边或右边(概率各1/2),且球的...
2018-02-19 02:19:30 618
原创 Yogurt factory
Yogurt factoryDescribeThe cows have purchased a yogurt factory that makes world-famous Yucky Yogurt. Over the next N (1 <= N <= 10,000) weeks, the price of milk and labor will fluctuate week...
2018-02-17 23:05:10 174
原创 Bin Packing
Bin PackingDescribeA set of n 1-dimensional items have to be packed in identical bins. All bins have exactly the same length l and each item i has length li<=l . We look for a minimal number of...
2018-02-17 20:26:21 702
原创 Supermarket
SupermarketDescribeA supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units startin...
2018-02-17 18:55:07 1093
原创 Train Problem II
Train Problem IIDescribe As we all know the Train Problem I, the boss of the Ignatius Train Station want to know if all the trains come in strict-increasing order, how many orders that all the tr
2018-02-17 17:30:07 251
原创 The Triangle(数字三角形)动态规划
The TriangleDescribe 7 3 8 8 1 0 2 7 4 4 4 5 2 6 5 (Figure 1)Figure 1 shows a number triangle. Write a program that calculate...
2018-02-17 02:17:18 349
原创 Argus
ArgusDescribeA data stream is a real-time, continuous, ordered sequence of items. Some examples include sensor data, Internet traffic, financial tickers, on-line auctions, and transaction logs suc...
2018-02-17 01:56:05 286
原创 Babelfish
BabelfishDescribeYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand...
2018-02-17 01:34:26 1156
原创 The Fun Number System
The Fun Number SystemDescribeIn a k bit 2’s complement number, where the bits are indexed from 0 to k-1, the weight of the most significant bit (i.e., in position k-1), is -2^(k-1), and the weight...
2018-02-16 23:56:10 249
原创 Specialized Four-Digit Numbers
Specialized Four-Digit NumbersDescribeFind and list all four-digit numbers in decimal notation that have the property that the sum of its four digits equals the sum of its digits when represented ...
2018-02-16 21:33:04 178
原创 The Circumference of the Circle
The Circumference of the CircleDescribeTo calculate the circumference of a circle seems to be an easy task - provided you know its diameter. But what if you don’t?You are given the cartesian coo...
2018-02-16 21:13:48 522
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人