自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(35)
  • 收藏
  • 关注

原创 G - 产生冠军

有一群人,打乒乓球比赛,两两捉对撕杀,每两个人之间最多打一场比赛。 球赛的规则如下: 如果A打败了B,B又打败了C,而A与C之间没有进行过比赛,那么就认定,A一定能打败C。 如果A打败了B,B又打败了C,而且,C又打败了A,那么A、B、C三者都不可能成为冠军。 根据这个规则,无需循环较量,或许就能确定冠军。你的任务就是面对一群比赛选手,在经过了若干场撕杀之后,确定是否已经实际上产生

2017-08-29 23:09:25 328

转载 A - Sorting It All Out

An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to largest. For example, the sorted sequence A, B, C, D im

2017-08-29 20:33:40 281

原创 C - Accepted Necklace

I have N precious stones, and plan to use K of them to make a necklace for my mother, but she won't accept a necklace which is too heavy. Given the value and the weight of each precious stone, please

2017-08-24 11:20:10 349

原创 A - Tempter of the Bone

The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone

2017-08-23 22:04:29 224

原创 B - Prime Ring Problem

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 should be a prime.Note: the number

2017-08-23 18:25:41 223

原创 D - Interesting Calculator

There is an interesting calculator. It has 3 rows of buttons.  Row 1: button 0, 1, 2, 3, ..., 9. Pressing each button appends that digit to the end of the display.Row 2: button +0, +1, +2, +3,

2017-08-22 15:57:21 237

原创 A - Enterprising Escape

The Enterprise is surrounded by Klingons! Find the escape route that has the quickest exit time, and print that time.    Input is a rectangular grid; each grid square either has the Enterprise or so

2017-08-21 18:41:02 253

原创 D - Matrix Chain Multiplication

Sample Input9A 50 10B 10 20C 20 5D 30 35E 35 15F 15 5G 5 10H 10 20I 20 25ABC(AA)(AB)(AC)(A(BC))((AB)C)(((((DE)F)G)H)I)(D(E(F(G(HI)))))((D(EF))((GH)I))Sample Output000error10

2017-08-14 20:27:21 278

原创 K - Ananagrams

输入一些单词,找出所有满足下列条件的单词;该单词不能通过重排变为输入文本的其他单词。判断时字母不分大小写,但在输出时应该保留大小写,并按字典序输出;在进行文本输入时,每输入一个单词将他放到vector,同时开一个map,用输入的单词作key,出现的次数作为value,当然作为key的单词要先经过处理,将它小写化并按字典序排序,然后再放入key中,这样文本输完后,原始文本保存在vecto

2017-08-14 16:30:51 373

原创 J - Andy's First Dictionary

输入一个文本,找出所有不同的单词(连续的字#include #include #include #include #include #include using namespace std;int main(){ setdict; string str;//freopen("1.txt","r",stdin); while(cin>>str) {

2017-08-14 15:37:39 291

转载 C - 平行四边形数

在一个平面内给定n个点,任意三个点不在同一条直线上,用这些点可以构成多少个平行四边形?一个点可以同时属于多个平行四边形。Input多组数据(每组数据第一行一个整数n(4Output每组数据输出一个整数,表示用这些点能构成多少个平行四边形。Sample Input40 11 01 12 0Sample Output1 /*Sherl

2017-08-13 23:23:24 1014

原创 F - Ugly Numbers

丑数是指不能被2 3 5以外的其他素数整除的数,把丑数从小到大排列起来,结果如下  1 2 3 4 5 6 8 9 10  12 15   求第1500个丑数;#include #include #include #include #include#include#include#include#includeusing namespace std;typedef long

2017-08-13 22:52:14 222

原创 E - Team Queue

Sample Input23 101 102 1033 201 202 203ENQUEUE 101ENQUEUE 201ENQUEUE 102ENQUEUE 202ENQUEUE 103ENQUEUE 203DEQUEUEDEQUEUEDEQUEUEDEQUEUEDEQUEUEDEQUEUESTOP25 259001 259002 259003 259004

2017-08-13 20:39:40 298

原创 B - Rails

DescriptionThere is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time. It was po

2017-08-12 19:26:49 260

原创 卡特兰数

卡特兰数的应用:矩阵连乘: P=a1×a2×a3×……×an,依据乘法结合律,不改变其顺序,只用括号表示成对的乘积,试问有几种括号化的方案?一个栈(无穷大)的进栈序列为1,2,3,…,n,有多少个不同的出栈序列?h[i]=h[i-1]*(4*i-2)/(i+1)对于csuxushu来说,能够在CSU(California State Un

2017-08-11 16:59:12 246

原创 B - A+B (III)

Your task is to Calculate a + b.InputThere are multiple test cases. Each test case contains only one line. Each line consists of a pair of integersa and b ( 1 a, b 16 ) , separated by a space. I

2017-08-11 10:21:47 281

原创 B - 完美的数字

Bob是个很喜欢数字的孩子,现在他正在研究一个与数字相关的题目,我们知道一个数字的完美度是 把这个数字分解成三个整数相乘A*A*B(0S,S表示的是从a到b的所有数字的流行度之和,即S=d(a)+d(a+1)+…+d(b)。Input输入两个整数a,b(1Output输出一个整数,表示从a到b的所有数字流行度之和。 Sample Input1 80Sample Ou

2017-08-10 22:00:38 298

原创 C - USACO ORZ

Like everyyione, cows enjoy variety. Their current fancy is new shapes for pastures. The old rectangular shapes are out of favor; new geometries are the favorite.I. M. Hei, the lead cow pasture ar

2017-08-10 08:51:48 395

原创 P - Big Number

In many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are given a number, you h

2017-08-07 19:37:20 293

原创 L - Digital Roots

The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two

2017-08-07 17:24:10 215

原创 next_permutation()的用法,与作用

在枚举排列中,用stl中的nextpermutation()函数无论输入的序列中是否都是重复元素#include #include #include using namespace std;int p[100];int main(){ int n;cin>>n; for(int i=0;i>p[i]; sort(p,p+n); do {

2017-08-07 11:59:42 1325

原创 生成可重集的排列

输入数组P,按字典序输出p各元素的全排列#include using namespace std;int a[100];void print_per(int n,int a[],int p[],int cur){ if(cur==n) { for(int i=0;i<n;i++)cout<<a[i]; cout<<endl; }

2017-08-07 11:46:54 340

原创 生成1~n的排列

先生成以一开头的排列,#include using namespace std;int a[100];void print_per(int n,int a[],int cur){ if(cur==n) { for(int i=0;i<n;i++)cout<<a[i]; cout<<endl; } else {

2017-08-07 11:08:51 392

原创 D - Twenty-four point

Given four numbers, can you get twenty-four through the addition, subtraction, multiplication, and division? Each number can be used only once.InputThe input consists of multiple test cases. Eac

2017-08-06 22:16:34 224

原创 C - 单源最大权路径

有一棵由N个结点构成的树,每一条边上都有其对应的权值。现在给定起点,求从该点出发的一条路径(至少有一条边)使得这条路径上的权值之和最大,并输出这个最大值。Input第一行一个正整数T,代表数据组数。每组数据第一行两个正整数n(2Output每组数据输出一行,即所找到路径的最大权值(格式参见样例)。Sample Input23 11 2 101 3 55

2017-08-06 15:59:15 420

原创 B - N皇后问题

在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。Sample I...

2017-08-05 20:33:08 288

原创 K - K-Nice

This is a super simple problem. The description is simple, the solution is simple. If you believe so, just read it on. Or if you don't, just pretend that you can't see this one.We say an element is

2017-08-03 22:40:20 360

原创 B - Light Bulb

Compared 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 incommodious house,

2017-08-03 21:12:56 311

原创 R - Fibonacci Again

There are another kind of Fibonacci numbers: F(0) = 7, F(1) = 11, F(n) = F(n-1) + F(n-2) (n>=2).InputInput consists of a sequence of lines, each containing an integer n. (n < 1,000,000).Output

2017-08-03 11:04:11 232

原创 Y - Ignatius and the Princess IV

"OK, you are not too bad, em... But you can never pass the next test." feng5166 says. #include #include #include #include#include#includeusing namespace std;int g[999999];int main(){ int

2017-08-03 10:08:46 198

原创 C - 分拆素数和

把一个偶数拆成两个不同素数的和,有几种拆法呢? Input输入包含一些正的偶数,其值不会超过10000,个数不会超过500,若遇0,则结束。Output对应每个偶数,输出其拆成不同素数的个数,每个结果占一行。Sample Input30260Sample Output32先把10000以内全部的素数找出来,再用这些素数去枚举要求的和;#include#include

2017-08-02 10:12:28 881

原创 G - Children’s Queue

There are many students in PHT School. One day, the headmaster whose name is PigHeader wanted all students stand in a line. He prescribed that girl can not be in single. In other words, either no girl

2017-08-01 20:20:52 267

原创 L - Cakeminator

You are given a rectangular cake, represented as an r × c grid. Each cell either has an evil strawberry, or is empty. For example, a3 × 4 cake may look as follows:The cakeminator is going to e

2017-08-01 17:06:47 390

原创 A - Two Substrings

You are given string s. Your task is to determine if the given strings contains two non-overlapping substrings "AB" and "BA" (the substrings can go in any order).InputThe only line of input

2017-08-01 16:13:45 417 1

原创 F - The Number of Paths

Let f (n) be the number of paths with n steps starting from O (0, 0), with steps of the type (1, 0), or (-1, 0), or (0, 1), and never intersecting themselves. For instance, f (2) =7, as shown in Fig.1...

2017-08-01 10:41:35 484

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除