UVA
文章平均质量分 68
Problems and solutions on UVA
Xiao Cao
I prefer thinking and imaging than doing. I am looking for principles and truth.
展开
-
490 - Rotating Sentences
Rotating Sentences In ``Rotating Sentences,'' you are asked to rotate a series of input sentences 90 degrees clockwise.So instead of displaying the input sentences from left to right and t原创 2014-02-24 17:26:40 · 769 阅读 · 0 评论 -
11729 - Commando War
解题思路1.将两个数组进行升序排序,这里的数据规模为20000,所以需要n^2以下的复杂度2.排好序之后,将两个数组从小到大进行匹配,这里的算法思想是贪心,可以证明这样做是正确的3.写代码时,主要不要混用C和C++,UVa的judge对此比较严格4.算法的时间复杂度是O(nlogn+mlogm),空间复杂度是O(n+m原创 2016-03-21 18:25:29 · 315 阅读 · 1 评论 -
100 - The 3n + 1 problem
题目Time limit: 3.000 secondspdf题目解题思路1.这里不涉及什么技巧,用循环不断迭代即可2.对于一个正整数n,不知道它迭代的次数是多少,所以整个问题的时间复杂度没办法知道,但可以表示成Θ((i-j)*一次迭代的时间复杂度)通过代码#includeint main(){ int i,j,I原创 2016-03-24 12:42:32 · 298 阅读 · 1 评论 -
1388 - Graveyard (Time limit: 3.000 seconds)
题目:Programming contests became so popular in the year 2397 that the governor of New Earck — the largest human-inhabited planet of the galaxy — opened a special Alley of Contestant Memories (ACM) at the原创 2016-03-14 09:39:09 · 394 阅读 · 0 评论 -
10189 - Minesweeper
题目Time limit: 3.000 secondspdf题目解题思路1.这里不涉及什么技巧,用循环不断加即可,注意越界2.需要注意的是输入和输出格式。输入的时候最好用scanf,它以空白字符作为结束符;输出的时候注意空格:答案之间有空格,但是最后一个答案之后不能有空格,否则会错。提交的两次错误都在输出格式上通过代码#i原创 2016-03-25 10:42:49 · 324 阅读 · 0 评论 -
10142 - Australian Voting
题目Time limit: 3.000 secondspdf题目解题思路1.模拟题,一定要小心,把题意搞明白,并且把输入的各种情况都想清楚了再写代码2.所有的细节都在代码里了,我已经将代码弄的极简洁极易懂了3.当有人被淘汰出局时,不能把这些票加到现有的候选者上,必须重新计算(不能只修改某些现有的候选者的票数)。道理很简单但却不明显,一个出错的原创 2016-04-09 22:25:34 · 457 阅读 · 0 评论 -
10137 - The Trip
题目10137 - The Trip Time limit: 3.000 secondsA number of students are members of a club that travels annually to exotic locations. Their destinations in the past have included Indianapolis, Phoenix, Na原创 2016-04-28 17:40:39 · 319 阅读 · 0 评论 -
10033 - Interpreter
题目10033 - Interpreter Time limit: 3.000 secondsA certain computer has 10 registers and 1000 words of RAM. Each register or RAM location holds a 3-digit integer between 0 and 999. Instructions are enco原创 2016-04-28 19:37:14 · 424 阅读 · 0 评论 -
10038 - Jolly Jumpers
题目https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=30&problem=979&mosmsg=Submission+received+with+ID+17410928 解题思路 1. 模拟题 2. 用hash判断diff(1~n-1) 3. 注意原创 2016-05-24 21:39:37 · 498 阅读 · 0 评论 -
706 - LC-Display
题目Time limit: 3.000 secondspdf题目解题思路1.把一个数字看成是5*3的矩阵,提前算好10个数字的打印模式,最后根据输入一行一行地输出2.设n是打印数值的位数,那么时间复杂度是Θ(n),空间复杂度是O(1)通过代码#include#includebool h1[10]={1,0,1,1,0原创 2016-04-25 09:30:10 · 297 阅读 · 0 评论 -
10196 - Check The Check
题目Time limit: 3.000 secondsYour task is to write a program that reads a chess board configuration and answers if there’s a king under attack (i.e. “in check”). A king is in check if it’s in a square wh原创 2016-05-20 14:59:54 · 587 阅读 · 1 评论 -
11292 - Dragon of Loowater (Time limit: 1.000 seconds)
题目解题思路1.将两个数组进行升序排序,这里的数据规模为20000,所以需要n^2以下的复杂度2.排好序之后,将两个数组从小到大进行匹配,这里的算法思想是贪心,可以证明这样做是正确的3.写代码时,主要不要混用C和C++,UVa的judge对此比较严格4.算法的时间复杂度是O(nlogn+mlogm),空间复杂度是O(n+m原创 2016-03-19 09:51:20 · 472 阅读 · 2 评论 -
488 - Triangle Wave
Triangle Wave In this problem you are to generate a triangular wave form according to a specified pair ofAmplitude and Frequency.Input and OutputThe input begins with a single positive integer原创 2014-02-24 17:21:03 · 568 阅读 · 0 评论 -
494 - Kindergarten Counting Game
Kindergarten Counting Game Everybody sit down in a circle. Ok. Listen to me carefully.``Woooooo, you scwewy wabbit!''Now, could someone tell me how many words I just said?Input and原创 2014-02-24 17:28:17 · 560 阅读 · 0 评论 -
414 - Machined Surfaces
414 - Machined SurfacesTime limit: 3.000 seconds An imaging device furnishes digital images of two machined surfaces that eventually will be assembled in contact with each other. The roughness原创 2014-02-24 16:55:45 · 959 阅读 · 0 评论 -
10055 - Hashmat the Brave Warrior
Problem AHashmat the brave warriorInput: standard inputOutput: standard output Hashmat is a brave warrior whowith his group of young soldiers moves from one place to another to fightag原创 2014-02-24 17:32:12 · 773 阅读 · 0 评论 -
458 - The Decoder
The Decoder Write a complete program that will correctly decode a set ofcharacters into a valid message. Your program shouldread a given file of a simple coded set of characters and print原创 2014-02-24 17:19:23 · 508 阅读 · 0 评论 -
445- Marvelous Mazes
Marvelous Mazes Your mission, if you decide to accept it, is to create a mazedrawing program. A maze will consist of the alphabeticcharactersA-Z, * (asterisk), and spaces.Input and O原创 2014-02-24 17:13:43 · 492 阅读 · 0 评论 -
10071 - Back to High School Physics
Problem BBack to High School PhysicsInput: standard inputOutput: standard output A particle has initial velocity and constant acceleration. Ifits velocity after certain time is v then what w原创 2014-02-24 17:35:03 · 693 阅读 · 0 评论 -
694 - The Collatz Sequence
The Collatz Sequence An algorithm given by Lothar Collatz produces sequences of integers, and isdescribed as follows:Step 1:Choose an arbitrary positive integer A as the first item inthe原创 2014-02-24 17:30:47 · 540 阅读 · 0 评论 -
489 - Hangman Judge
Hangman Judge In ``Hangman Judge,'' you are to write a program that judges a series of Hangman games. Foreach game, the answer to the puzzle is given as well as the guesses. Rules are the原创 2014-02-24 17:23:07 · 685 阅读 · 0 评论 -
457 - Linear Cellular Automata
Linear Cellular Automata A biologist is experimenting with DNA modification ofbacterial colonies being grown in a linear array of culture dishes. Bychanging the DNA, he is able ``program" the bacter原创 2014-02-24 17:16:33 · 2631 阅读 · 0 评论 -
401 - Palindromes
401 - PalindromesTime limit: 3.000 secondsPalindromes A regular palindrome is a string of numbers or letters that is the same forward as backward. For example, the string原创 2014-03-04 23:10:47 · 602 阅读 · 0 评论 -
10300 - Ecological Premium
Problem AEcological PremiumInput: standard inputOutput: standard outputTime Limit: 1 secondMemory Limit: 32 MBGerman farmers are given a premium depending onthe conditions at their farmyar原创 2014-02-24 17:36:42 · 638 阅读 · 0 评论 -
10267 - Graphical Editor
题目https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=29&problem=1208&mosmsg=Submission+received+with+ID+17405109 解题思路模拟题,F命令用广搜加入候选pixel时,用hash判断是否已经在队列里原创 2016-05-23 19:50:31 · 426 阅读 · 0 评论