UVA
文章平均质量分 60
雪岩ding
判题机你不讲武德~
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
UVA-400(输出控制格式)
Unix ls UVA - 400The computer company you work for is introducing a brand new computer line and is developing anew Unix-like operating system to be introduced along with the new computer. Your assignment is towrite the formatter for the ls function.You原创 2021-05-24 13:38:47 · 523 阅读 · 0 评论 -
UVA-136(一点点数论+stl)
问题描述:Ugly numbers are numbers whose only prime factors are 2, 3 or 5. The sequence1, 2, 3, 4, 5, 6, 8, 9, 10, 12, 15, …shows the first 11 ugly numbers. By convention, 1 is included.Write a program to find and print the 1500’th ugly number.InputThere原创 2021-05-24 13:05:10 · 312 阅读 · 0 评论 -
UVA-101(vector应用)
The Blocks Problem UVA - 101问题描述:输入输出说明:思路:刚开始find_函数一直有问题,我是这样写的:void find_(int a,int &id,int &h){ for(int id=0;id<n;id++){ for(int h=0;h<v[id].size();h++){ if(v[id][h]==a)return ; } }}导致一直错误,排查半天参看到这里错了,不应该有里面再重定义id和h;整体原创 2021-05-23 19:10:06 · 404 阅读 · 0 评论 -
UVA-12563(背包dp)
Jin Ge Jin Qu hao UVA - 12563(If you smiled when you see the title, this problem is for you ^ _ ^)For those who don’t know KTV, see: http://en.wikipedia.org/wiki/Karaoke_boxThere is one very popular song called Jin Ge Jin Qu(). It is a mix of 37 songs,原创 2021-05-23 17:13:16 · 576 阅读 · 0 评论 -
UVA-116(dp)
Unidirectional TSP UVA - 116问题描述:输入输出说明:思路:pair< int , int > s[i][j]用于存放下一跳的坐标;int M[i][j]用于存储矩阵的值;int dp[i][j]用于存放当前位置为起点的最小权值路径和;ac code:#include<bits/stdc++.h>using namespace std;#define INF (1<<30)int M[12][102];int原创 2021-05-23 09:28:40 · 404 阅读 · 0 评论 -
UVA-1347(dp)
Tour UVA - 1347问题描述:输入输出说明:思路://规定i>jdp[i][j]表示第一个人走到位置i,第二个人走到位置j,还所需要走的最小距离;dist(i,j)表示i,j两个位置之间的距离;//要么第一个人走到i+1,要么第二个人走到i+1,dp[i][j]=min(dp[i+1][j]+dist(i,i+1),dp[i+1][i]+dist(j,i+1));ac code:#include<bits/stdc++.h>using namespace原创 2021-05-22 18:07:30 · 581 阅读 · 0 评论 -
UVA-437(带递归的dp)
The Tower of Babylon UVA - 437问题描述:输入输出说明:思路:带递归的dpac code:#include<bits/stdc++.h>using namespace std;struct Node{ int v[4];}a[40];int n;int k=0;int d[100][100];int dp(int i,int k){ int& ans=d[i][k]; if(ans!=-1)return ans; an原创 2021-05-21 17:40:10 · 397 阅读 · 0 评论 -
UVA-1025(dp)
A Spy in the Metro UVA - 1025问题说明:输入输出说明:思路:初始化havetrain三维数组,每输入一个d,就遍历n个车站的是否拥有车情况(true为有车,false为没车);状态转移:(倒着推~)dp[i][j]代表i时刻在j车站已经等待的时间;1)没车,在当前车站等一分钟dp[i][j]=dp[i+1][j]+1;2)i时刻j车站有向右走的车;if(j<n&&i+tim[j]<=t&&havetrain[i原创 2021-05-21 16:24:40 · 385 阅读 · 0 评论 -
UVA-401(模拟题)
Palindromes UVA - 401问题描述:输入输出说明:Sample InputNOTAPALINDROMEISAPALINILAPASI2A3MEASATOYOTASample OutputNOTAPALINDROME – is not a palindrome.ISAPALINILAPASI – is a regular palindrome.2A3MEAS – is a mirrored string.ATOYOTA – is a mirrored palindr原创 2021-05-19 18:04:15 · 492 阅读 · 0 评论 -
UVA-340(模拟题)
Master-Mind Hints UVA - 340问题描述:输入输出说明:Sample Input41 3 5 51 1 2 34 3 3 56 5 5 16 1 3 51 3 5 50 0 0 0101 2 2 2 4 5 6 6 6 91 2 3 4 5 6 7 8 9 11 1 2 2 3 3 4 4 5 51 2 1 3 1 5 1 6 1 91 2 2 5 5 5 6 6 6 70 0 0 0 0 0 0 0 0 00Sample OutputGa原创 2021-05-19 16:57:16 · 441 阅读 · 0 评论 -
UVA-11093(模拟题)
Just Finish it up UVA - 11093问题描述:输入输出说明:Sample Input251 1 1 1 11 1 2 1 171 1 1 10 1 1 12 2 2 2 2 2 2Sample OutputCase 1: Not possibleCase 2: Possible from station 4思路:按照紫书上的思路,模拟即可,但是要注意如果到pos已经不合法了,那么pos前面的位置都不合法,所以不用每一个位置都去遍历,时间复杂度为O(n);原创 2021-05-19 08:32:19 · 393 阅读 · 0 评论 -
UVA-12627(考眼力~)
Erratic Expansion UVA - 12627问题描述:输入输出说明:Sample Input30 1 13 1 83 3 7Sample OutputCase 1: 1Case 2: 27Case 3: 14思路1::分治Time limit exceeded code:#include<bits/stdc++.h>using namespace std;typedef long long ll;int k,f,e;ll getAns(in原创 2021-05-18 22:34:42 · 490 阅读 · 0 评论 -
UVA-714(思维题)
Copying Books UVA - 714问题描述:输入输出说明:Sample Input29 3100 200 300 400 500 600 700 800 9005 4100 100 100 100 100Sample Output100 200 300 400 500 / 600 700 / 800 900100 / 100 / 100 / 100 100思路:judge函数用于寻去最佳的划分尺寸,judge中一定要从右向左找(根据题意!),使用bool vis函数原创 2021-05-18 19:38:14 · 503 阅读 · 0 评论 -
UVA-10954(priority_queue的应用)
问题描述:输入输出描述:Sample Input31 2 341 2 3 40Sample Output919思路:huffman code编码过程ac code:#include<bits/stdc++.h>using namespace std;typedef long long ll;int n;int main(){ while(scanf("%d",&n)!=EOF&&n){ int num; ll ans=0;原创 2021-05-18 14:51:40 · 427 阅读 · 0 评论 -
UVA-11572(滑动窗口)
Unique Snowflakes UVA - 11572问题描述:输入输出说明:**思路:**滑动窗口算法设置l,r左右两个游标,只要没有重复的一直r++;知道遇到重复的,跳出内层循环,更新值,并去除a[l],l++;ac code:#include<bits/stdc++.h>using namespace std;typedef long long ll;int a[1000002];int n;int main(){ int t; scanf("%d",原创 2021-05-18 14:25:53 · 450 阅读 · 0 评论 -
UVA-11054(扫描法)
Wine trading in Gergovia UVA - 11054问题描述:输入输出说明:Sample Input55 -4 1 -3 16-1000 -1000 -1000 1000 1000 10000Sample Output99000**思路:**扫描法从第一个村庄开始,加入需要对酒的需求为m,则可以假设m个酒来自于第二个村庄(也可能是第二个村庄从别处运来的,但是不影响,问题规模从n减为了n-1),不管ai>0还是ai<0,ans+=abs(allsu原创 2021-05-18 14:22:13 · 377 阅读 · 0 评论 -
UVA-11134(greedy)
Fabled RooksSample Input81 1 2 25 7 8 82 2 5 52 2 5 56 3 8 66 3 8 56 3 8 83 6 7 881 1 2 25 7 8 82 2 5 52 2 5 56 3 8 66 3 8 56 3 8 83 6 7 80Sample Output1 15 82 44 27 38 56 63 71 15 82 44 27 38 56 63 7思路:1.行号列号二维问题相互独原创 2021-05-17 22:33:07 · 463 阅读 · 0 评论 -
UVA - 1152(unordered_map的应用)
4 Values whose Sum is 0 UVA - 1152The SUM problem can be formulated as follows: given four lists A, B, C, D of integer values, computehow many quadruplet (a, b, c, d) ∈ A × B × C × D are such that a + b + c + d = 0. In the following, weassume that all l原创 2021-05-17 21:09:03 · 533 阅读 · 0 评论 -
UVA - 1605(思维题)
Building for UN UVA - 1605The United Nations has decided to build a new headquarters in Saint Petersburg, Russia. It will have a form of a rectangular parallelepiped and will consist of several rectangular floors, one on top of another.Each floor is a re原创 2021-05-17 13:40:34 · 336 阅读 · 0 评论 -
UVA-120(reverse与max_element的应用)
Stacks of Flapjacks UVA - 120 (紫书P236)Stacks and Queues are often considered the bread and butter of data structures and find use in architecture, parsing, operating systems, and discrete event simulation. Stacks are also important in thetheory of forma原创 2021-05-16 21:41:30 · 475 阅读 · 0 评论 -
UVA-12657(vector<list<int>::iterator>与list<int>混合链表)
Boxes in a Line UVA - 12657You have n boxes in a line on the table numbered 1 . . . n from left to right. Your task is to simulate 4 kinds of commands:• 1 X Y : move box X to the left to Y (ignore this if X is already the left of Y )• 2 X Y : move box原创 2021-05-16 18:15:53 · 614 阅读 · 0 评论 -
UVA - 11988(list)
Broken Keyboard (a.k.a. Beiju Text) UVA - 11988You’re typing a long text with a broken keyboard. Well it’s not so badly broken. The only problemwith the keyboard is that sometimes the “home” key or the “end” key gets automatically pressed(internally).Y原创 2021-05-16 17:36:09 · 413 阅读 · 0 评论 -
UVA - 442(stl---map,pair,stack混用)
Matrix Chain Multiplication UVA - 442Suppose you have to evaluate an expression like ABCDE where A,B,C,D and E are matrices.Since matrix multiplication is associative, the order in which multiplications are performed is arbitrary.However, the number of原创 2021-05-16 17:19:40 · 370 阅读 · 0 评论 -
UVA-540(双队列)
Team Queue UVA - 540Queues and Priority Queues are data structures which are known to most computer scientists. TheTeam Queue, however, is not so well known, though it occurs often in everyday life. At lunch time thequeue in front of the Mensa is a team原创 2021-05-15 20:58:47 · 482 阅读 · 0 评论 -
UVA-12096(stl---set与stack与map大杂烩)
The SetStack Computer UVA - 12096Background from Wikipedia: “Set theory is abranch of mathematics created principally by theGerman mathematician Georg Cantor at the end ofthe 19th century. Initially controversial, set theoryhas come to play the role o原创 2021-05-15 19:58:28 · 546 阅读 · 0 评论 -
UVA-156(stl---map与string与set)
Ananagrams UVA - 156Most crossword puzzle fans are used to anagrams — groups of words with the same letters in differentorders — for example OPTS, SPOT, STOP, POTS and POST. Some words however do not have thisattribute, no matter how you rearrange their原创 2021-05-15 13:48:42 · 339 阅读 · 0 评论 -
UVA-10815(stl---stringstream的应用)
Andy’s First Dictionary UVA - 10815Andy, 8, has a dream - he wants to produce hisvery own dictionary. This is not an easy task forhim, as the number of words that he knows is,well, not quite enough. Instead of thinking up allthe words himself, he has原创 2021-05-15 13:19:57 · 385 阅读 · 0 评论 -
UVA-10474(implements)
Raju and Meena love to play with Marbles. They have got a lot ofmarbles with numbers written on them. At the beginning, Raju wouldplace the marbles one after another in ascending order of the numberswritten on them. Then Meena would ask Raju to find the原创 2021-05-14 22:33:12 · 351 阅读 · 0 评论 -
UVA-1339(vector内部sort)
Ancient Roman empire had a strong government system with various departments, including a secretservice department. Important documents were sent between provinces and the capital in encryptedform to prevent eavesdropping. The most popular ciphers in tho原创 2021-05-14 22:04:06 · 196 阅读 · 0 评论 -
UVA-272(implements)
InputInput will consist of several lines of text containing an even number of double-quote (") characters.Input is ended with an end-of-file character.OutputThe text must be output exactly as it was input except that:• the first " in each pair is re.原创 2021-05-13 22:03:33 · 374 阅读 · 0 评论 -
UVA - 10082(implements)
A common typing error is to place thehands on the keyboard one row to theright of the correct position. So ‘Q’ istyped as ‘W’ and ‘J’ is typed as ‘K’ andso on. You are to decode a message typed in this manner.InputInput consists of several lines of原创 2021-05-13 21:56:30 · 653 阅读 · 0 评论
分享