算法入门经典(UVa)
文章平均质量分 73
风往北吹~
岂能尽随人愿,但求无愧我心。
展开
-
倒三角形和等腰三角形
输入正整数n#includeint main(){ int i,j,k,n; while(~scanf("%d",&n)) { //打印倒三角形 printf("打印出倒三角形为:\n"); for(i=n;i>=0;i--) { //控制每行的空格数。 for(j=0;j<=n-i;j++) { printf(" ");原创 2015-12-09 17:41:52 · 853 阅读 · 0 评论 -
Rails(UVa514)(栈)
Rails There 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原创 2015-12-21 07:13:43 · 4450 阅读 · 0 评论 -
Primitive Roots(Poj1284)(欧拉函数+原根)
Primitive RootsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 3462 Accepted: 2025DescriptionWe say that integer x, 0 i mod p) | 1 <= i <= p-1 } is equa原创 2015-12-17 13:18:32 · 538 阅读 · 0 评论 -
UVa679(Dropping Balls)(二叉树的编号)
Dropping Balls A number of K balls are dropped one by one from the root of a fully binary tree structure FBT. Each time the ball being dropped first visits a non-terminal node. It then kee原创 2016-01-09 17:19:28 · 477 阅读 · 0 评论 -
UVa10720 ( Graph Construction)(判断是否可化为简单图)
Graph is a collection of edges E and vertices V. Graph has a wide variety of applications in computer.There are different ways to represent graph in computer. It can be represented by adjacency matri原创 2016-01-18 10:10:32 · 565 阅读 · 0 评论 -
分数拆分(Fractions Again?!,UVa 10976)
It is easy to see that for every fraction in the form 1k(k > 0), we can always find two positive integersx and y, x ≥ y, such that:1k=1x+1yNow our question is: can you write a p原创 2015-12-16 11:21:31 · 802 阅读 · 0 评论 -
最大乘积(Maximum Product,UVa11059)
Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of themaximum positive product involving consecutive terms of S. If you cannot find a positive sequence,原创 2015-12-15 10:45:01 · 1181 阅读 · 0 评论 -
除法(Division,UVa 725)
Division Write a program that finds and displays all pairs of 5-digit numbers that between them use the digits 0through 9 once each, such that the first number divided by the second is equ原创 2015-12-14 22:39:39 · 724 阅读 · 0 评论 -
救济金发放(The Dole Queue,UVa33)
The Dole Queue In a serious attempt to downsize (reduce) the dole queue, The New National Green Labour Rhinoceros Party has decided on the following strategy. Every day all dole applicants原创 2015-12-14 16:16:22 · 1285 阅读 · 0 评论 -
刽子手游戏(Hangman judge,Uva489)
Hangman Judge In ``Hangman Judge,'' you are to write a program that judges a series of Hangman games. For each game, the answer to the puzzle is given as well as the guesses. Rules are the原创 2015-12-13 22:40:19 · 2512 阅读 · 0 评论 -
古老的密码(Poj2159)
Ancient CipherTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 31217 Accepted: 10209DescriptionAncient Roman empire had a strong government system with v原创 2015-12-13 21:44:39 · 695 阅读 · 0 评论 -
UVA10815 Andy's First Dictionary(STL)
Andy's First DictionaryAndy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him, as the number of words that he knows is, well, not quite enough. Instea原创 2015-12-10 19:44:11 · 1691 阅读 · 0 评论 -
大理石在哪儿(UVa 10474)(排序与检索)
大理石在哪儿现有N个大理石,每个大理石上写了一个非负整数、首先把各数从小到大排序然后回答Q个问题。每个问题问是否有一个大理石写着某个整数x,如果是,还要回答哪个大理石上写着x。排序后的大理石从左到右编号为1~N。(在样例中,为了节约篇幅,所有大理石的数合并到一行,所有问题也合并到一行。)样例输入:4 12 3 5 155 21 3 3 3 1原创 2015-12-10 07:40:57 · 1109 阅读 · 0 评论 -
The SetStack Computer(UVa12096&&POJ3121) (集合栈)
The SetStack ComputerTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1095 Accepted: 219DescriptionBackground from Wikipedia: "Set theory is a branch of ma原创 2015-12-26 16:59:22 · 990 阅读 · 0 评论