12 2012 档案
摘要:1、cin 1、cin.get() 2、cin.getline() 3、getline() 4、gets() 5、getchar()1、cin>> 用法1:最基本,也是最常用的用法,输入一个数字:#include <iostream> using namespace std; main () { int a,b; cin>>a>>b; cout<<a+b<<endl; }输入:2[回车]3[回车] 输出:5用法2:接受一个字符串,遇“空格”、“TAB”、“回车”都结束#include <iostream> us
阅读全文
摘要:Assignmentshttp://acm.hdu.edu.cn/showproblem.php?pid=3661Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1205 Accepted Submission(s): 559 Problem DescriptionIn a factory, there are N workers to finish two types of tasks (A and B). Each type has N
阅读全文
摘要:Permutation Countinghttp://acm.hdu.edu.cn/showproblem.php?pid=3664Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1001 Accepted Submission(s): 496 Problem DescriptionGiven a permutation a1, a2, … aN of {1, 2, …, N}, we define its E-value as the a
阅读全文
摘要:Seasidehttp://acm.hdu.edu.cn/showproblem.php?pid=3665Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 802 Accepted Submission(s): 562 Problem DescriptionXiaoY is living in a big city, there are N towns in it and some towns near the sea. All these
阅读全文
摘要:Rightmost Digithttp://acm.hdu.edu.cn/showproblem.php?pid=1061Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 21580 Accepted Submission(s): 8242 Problem DescriptionGiven a positive integer N, you should output the most right digit of N^N.InputThe
阅读全文
摘要:Humble Numbershttp://acm.hdu.edu.cn/showproblem.php?pid=1058Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10972 Accepted Submission(s): 4780 Problem DescriptionA number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequ
阅读全文
摘要:六种qsort排序方法<本文中排序都是采用的从小到大排序>一、对int类型数组排序int num[100];Sample:int cmp ( const void *a , const void *b ){ return *(int *)a - *(int *)b;}qsort(num,100,sizeof(num[0]),cmp);二、对char类型数组排序(同int类型)char word[100];Sample:int cmp( const void *a , const void *b ){ return *(char *)a - *(char *)b;}qsort(w..
阅读全文
摘要:FatMouse' Tradehttp://acm.hdu.edu.cn/showproblem.php?pid=1009Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 28122 Accepted Submission(s): 9028 Problem DescriptionFatMouse prepared M pounds of cat food, ready to trade with the cats guarding t
阅读全文
摘要:小陈老师、雪人http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1176Time Limit: 1000 MSMemory Limit: 65536 KTotal Submit: 79(22 users)Total Accepted: 32(14 users)Rating:Special Judge: YesDescription东北的冬季,尤其是过年的时候,小陈老师喜欢去堆雪人。 每个雪人主要由三个雪球构成:大雪球、中雪球、小雪球。 他已经准备好了N个雪球,半径分别等于r1, r2
阅读全文
摘要:Train Problem Ihttp://acm.hdu.edu.cn/showproblem.php?pid=1022Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 12861 Accepted Submission(s): 4705 Problem DescriptionAs the new term comes, the Ignatius Train Station is very busy nowadays. A lot of s
阅读全文
摘要:A sequence of numbershttp://acm.hdu.edu.cn/showproblem.php?pid=2817Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1594 Accepted Submission(s): 494 Problem DescriptionXinlv wrote some sequences on the paper a long time ago, they might be arithmet
阅读全文
摘要:Ball bearingshttp://acm.hdu.edu.cn/showproblem.php?pid=1943Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 43 Accepted Submission(s): 22 Problem DescriptionThe Swedish company SKF makes ball bearings. As explained by Britannica Online, a ball bea
阅读全文
摘要:Faulty Odometerhttp://acm.hdu.edu.cn/showproblem.php?pid=4278Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 725 Accepted Submission(s): 512 Problem Description You are given a car odometer which displays the miles traveled as an integer. The od.
阅读全文
摘要:Max Factorhttp://acm.hdu.edu.cn/showproblem.php?pid=2710Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2412 Accepted Submission(s): 734 Problem DescriptionTo improve the organization of his farm, Farmer John labels each of his N (1 <= N <=
阅读全文
摘要:Huntershttp://acm.hdu.edu.cn/showproblem.php?pid=4438Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 382 Accepted Submission(s): 281 Problem DescriptionAlice and Bob are the topmost hunters in the forest, so no preys can escape from them. However
阅读全文
摘要:Sum of divisorshttp://acm.hdu.edu.cn/showproblem.php?pid=4432Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 875 Accepted Submission(s): 342 Problem Descriptionmmm is learning division, she's so proud of herself that she can figure out the su
阅读全文
摘要:Online Judgehttp://www.cnblogs.com/kuangbin/archive/2012/10/28/2743788.htmlTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 3589 Accepted Submission(s): 1349 Problem DescriptionIgnatius is building an Online Judge, now he has worked out all the pr
阅读全文
摘要:Dressinghttp://acm.hdu.edu.cn/showproblem.php?pid=4451Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1112 Accepted Submission(s): 471 Problem DescriptionWangpeng has N clothes, M pants and K shoes so theoretically he can have N×M×K dif
阅读全文
摘要:Integer Inquiryhttp://acm.hdu.edu.cn/showproblem.php?pid=1047Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 7564 Accepted Submission(s): 1961 Problem DescriptionOne of the first users of BIT's new supercomputer was Chip Diller. He extended h
阅读全文
摘要:N!http://acm.hdu.edu.cn/showproblem.php?pid=1042Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 37977 Accepted Submission(s): 10555 Problem DescriptionGiven an integer N(0 ≤ N ≤ 10000), your task is to calculate N!InputOne N in one line, process
阅读全文
摘要:A + B Problem IIhttp://acm.hdu.edu.cn/showproblem.php?pid=1002Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 137421 Accepted Submission(s): 26074 Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to
阅读全文
摘要:Biorhythmshttp://poj.org/problem?id=1006Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 97029Accepted: 29832DescriptionSome people believe that there are three cycles in a person's life that start the day he or she is born. These three cycles are the physical, emotional, and intellectua
阅读全文
摘要:初期: 一.基本算法: (1)枚举. (poj1753,poj2965) (2)贪心(poj1328,poj2109,poj2586) (3)递归和分治法. (4)递推. (5)构造法.(poj3295) (6)模拟法.(poj1068,poj2632,poj1573,poj2993,poj2996)二.图算法: (1)图的深度优先遍历和广度优先遍历. (2)最短路径算法 (dijkstra,bellman-ford,floyd,heap+dijkstra) (poj1860,poj3259,poj1062,poj2253,poj1125,poj2240) (3)最小生成树算法(prim,k.
阅读全文
摘要:Stickshttp://poj.org/problem?id=1011Time Limit: 1000MSMemory Limit: 10000KTotal Submissions: 103691Accepted: 23627DescriptionGeorge took sticks of the same length and cut them randomly until all parts became at most 50 units long. Now he wants to return sticks to the original state, but he forgot ho
阅读全文
摘要:Exponentiationhttp://poj.org/problem?id=1001Time Limit: 500MSMemory Limit: 10000KTotal Submissions: 111912Accepted: 27180DescriptionProblems involving the computation of exact values of very large magnitude and precision are common. For example, the computation of the national debt is a taxing exper
阅读全文
摘要:排序 1002(需要字符处理,排序用快排即可) 1007(稳定的排序) 2159(题意较难懂) 2231 2371(简单排序) 2388(顺序统计算法) 2418(二叉排序树)回溯搜索:1979(和迷宫类似) 1980(对剪枝要求较高)数学计算简单(或不值得做的题):1003 1004 1005 1068 1326 1656 1657 1658 1663 1922 1978 2000 2013 2014 2017 2070 2101 2105 2140 2190 2272 2301 2405 2419 中等:1006(中国剩余定理) 1323 1969 2015(解密码) 2081(预处理)
阅读全文
摘要:BabelfishTime Limit : 6000/3000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 11 Accepted Submission(s) : 8Problem DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you hav
阅读全文
摘要:WormholesTime Limit : 4000/2000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 15 Accepted Submission(s) : 10Problem DescriptionWhile exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way
阅读全文
摘要:SquaresTime Limit : 7000/3500ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 12 Accepted Submission(s) : 11Problem DescriptionA square is a 4-sided polygon whose sides have equal length and adjacent sides form 90-degree angles. It is also a polygon such that rotating a
阅读全文
摘要:Shuffle'm UpTime Limit : 2000/1000ms (Java/Other) Memory Limit : 131072/65536K (Java/Other)Total Submission(s) : 41 Accepted Submission(s) : 23Problem DescriptionA common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two s
阅读全文
摘要:统计难题Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others) Total Submission(s): 11471 Accepted Submission(s): 4824 Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀).Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignat
阅读全文
摘要:确定比赛名次Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 24 Accepted Submission(s) : 17Problem Description有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排
阅读全文
摘要:Constructing RoadsTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 9149 Accepted Submission(s): 3383 Problem DescriptionThere are N villages, which are numbered from 1 to N, and you should build some roads such that every two villages can connect
阅读全文
摘要:The Euler functionTime Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submission(s) : 26 Accepted Submission(s) : 16Problem DescriptionThe Euler function phi is an important kind of function in number theory, (n) represents the amount of the numbers which are smaller
阅读全文