uva
文章平均质量分 88
coding__girl
这个作者很懒,什么都没留下…
展开
-
UVA 146 ID Codes
It is 2084 and the year of Big Brother has finally arrived, albeit a century late. In order to exercise greater control over its citizens and thereby to counter a chronic breakdown in law and order, th原创 2017-09-13 22:05:01 · 147 阅读 · 0 评论 -
UVA 352 The Seasonal War
The inhabitants of Tigerville and Elephantville are engaged in a seasonal war. Last month, Elephantville successfully launched and orbited a spy telescope called the Bumble Scope. The purpose of the Bu原创 2017-10-02 17:15:09 · 412 阅读 · 0 评论 -
UVA 417 Word Index
Encoding schemes are often used in situations requiring encryption or information storage/transmission economy. Here, we develop a simple encoding scheme that encodes particular types of words with ve原创 2017-10-02 17:30:08 · 364 阅读 · 0 评论 -
UVA 439 Knight Moves
A friend of you is doing research on the Traveling Knight Problem (TKP) where you are to nd the shortest closed tour of knight moves that visits each square of a given set of n squares on a chessboard原创 2017-10-02 17:40:45 · 182 阅读 · 0 评论 -
UVA 532 Dungeon Master
You are trapped in a 3D dungeon and need to nd the quickest way out! The dungeon is composed of unit cubes which may or may not be lled with rock. It takes one minute to move one unit north, south, e原创 2017-10-03 13:48:29 · 204 阅读 · 0 评论 -
UVA 572 Oil Deposits
The GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a grid that divides the原创 2017-10-03 14:06:34 · 203 阅读 · 0 评论 -
UVA 10142 Australian Voting
Australian ballots require that the voter rank the candidates in order of choice. Initially only the first choices are counted and if one candidate receives more than 50% of the vote, that candidate is原创 2017-10-03 14:20:41 · 411 阅读 · 0 评论 -
UVA 10926 How Many Dependencies?
In this problem you will need to find out which task has the most number of dependencies. A task A depends on another task B if B is a direct or indirect dependency of A. For example, if A depends on原创 2017-10-03 14:45:14 · 238 阅读 · 0 评论 -
UVA 122 Trees on the level
题意: 给出二叉树的结点值及其路径,按从上到下,从左到右的顺序输出二叉树各个结点值,若没有根节点或有重复,输出“not complete” 思路: ‘L’字典序<‘R’,因此输出顺序即为各个结点按路径从小到大排序。 建立结构体Pair,储存每个节点的值及其路径,并重载运算符‘<’。用vector存储各个结点,利用sort()排序,默认为升序 注意输入格式#include <iostream原创 2017-10-11 22:17:40 · 188 阅读 · 0 评论 -
UVA 107 The Cat in the Hat
(An homage to Theodore Seuss Geisel) The Cat in the Hat is a nasty creature, But the striped hat he is wearing has a rather nifty feature. With one ick of his wrist he pops his top o . Do you know原创 2017-10-11 22:27:35 · 197 阅读 · 0 评论 -
UVA 536 Tree Recovery
题意: 给出一个二叉树的前序遍历和中序遍历,输出其后序遍历 思路: 利用递归,将前序数组和中序数组不断划分,不断将前序数组的第一个值存入后序数组#include <iostream>#include <string>using namespace std;string per,in,pos;void initial(){ pos.clear();//清空字符串}void原创 2017-10-11 22:34:28 · 209 阅读 · 0 评论 -
uva 10080 Gopher II【匈牙利算法】
The gopher family, having averted the canine threat, must face a new predator. The are n gophers and m gopher holes, each at distinct (x,y) coordinates. A hawk arrives and if a gopher does not reach a原创 2017-11-17 12:06:40 · 489 阅读 · 0 评论 -
UVA 10092 The Problem with the Problemsetter
The number of students interested to participate in this year’s Intra-BUET Programming Contest is huge. Since it is very difficult to accommodate such a large number of students in our labs, we have de原创 2017-11-15 22:08:39 · 464 阅读 · 0 评论 -
uva 670 The dog task
匈牙利算法,将狗的兴趣点与人走的每段路作二部图(即图的左边是点,右边是边),求出该二部图对于狗的兴趣点的最大匹配数,再加上人必经的点数,就是狗的路线。#include <iostream>#include <cmath>#include <vector>#include <cstring>using namespace std;const int Maxn=105;int N,M;do原创 2017-11-16 10:37:13 · 175 阅读 · 0 评论 -
uva 10405 Longest Common Subsequence
求两个字符串x,y的最长公共子序列 dp[i][j]表示x的前缀xi和y的前缀yj的LCS的长度 状态转移方程为: if(a[i]==b[j]) dp[i][j]=dp[i-1][j-1]+1; else dp[i][j]=Max{dp[i-1][j],dp[i],[j-1]};#include <iostream>#include <cstring&...原创 2018-03-14 10:31:44 · 128 阅读 · 0 评论 -
uva 10192 Vacation
You are planning to take some rest and to go out on vacation, but you really don’t know which cities you should visit. So, you ask your parents for help. Your mother says “My son, you MUST visit Paris...原创 2018-03-14 10:37:51 · 154 阅读 · 0 评论 -
uva 531 Compromise
In a few months the European Currency Union will become a reality. However, to join the club, the Maastricht criteria must be ful lled, and this is not a trivial task for the countries (maybe except f...原创 2018-03-14 11:11:25 · 183 阅读 · 0 评论 -
UVA 336 A Node Too Far
题意: 给出点的个数及各个点之间的联通情况,输出从某点开始沿联通图路线走n步后不能到达的点的个数,0 0结束 思路: 用bfs搜索每个点#include <iostream>#include <map>#include <queue>#include <vector>using namespace std;//int vis[1000];int N,T,cnt;map<int,v原创 2017-10-02 17:09:24 · 352 阅读 · 1 评论 -
UVA 260 Il Gioco dell'X
题意: 黑白两方下棋,必有一人胜出,若黑棋能从第一行走到最后一行则Black胜出,若白棋能从能从第一列走到最后一列则White胜出 思路: 只需判断Black是否胜出,用dfs搜索黑棋能否能从第一行走到最后一行#include <iostream>using namespace std;int N,flag=0;int dx[]={1,0,1,0,-1,-1};//记录六个方向int原创 2017-10-02 16:55:56 · 190 阅读 · 0 评论 -
UVA 170 Clock Patience
题意: 将牌依次分成13堆,牌面朝下,按从1到13的顺序发牌,然后从第K堆第一张开始翻牌,然后将该牌放在这一堆的最下面,面朝上,接着翻牌面上显示的数字那一堆的第一张面朝下的牌,重复此过程,直到所有牌都面朝上,输出翻牌的次数以及最后一次翻的牌 思路: 用队列数组保存13堆牌,用结构体存储每张牌的面值、花色、面朝上/朝下,然后模拟翻牌过程#include <iostream>#include原创 2017-10-02 16:47:33 · 277 阅读 · 0 评论 -
UVA 299 Train Swapping
At an old railway station, you may still encounter one of the last remaining “train swappers”. A train swapper is an employee of the railroad, whose sole job it is to rearrange the carriages of trains.原创 2017-09-13 23:19:49 · 190 阅读 · 0 评论 -
uva 10008 What's Cryptanalysis?
Cryptanalysis is the process of breaking someone else’s cryptographic writing. This sometimes involves some kind of statistical analysis of a passage of (encrypted) text. Your task is to write a progra原创 2017-09-14 16:12:51 · 271 阅读 · 0 评论 -
uva 10041 Vito's Family
The world-known gangster Vito Deadstone is moving to New York. He has a very big family there, all of them living in Lamafia Avenue. Since he will visit all his relatives very often, he is trying to fi原创 2017-09-14 16:29:40 · 312 阅读 · 0 评论 -
uva 10107 What is the Median?
题意: 不断添加整数n到数组,每次输出当前所有数的中位数代码:#include <iostream>#include<cmath>#include<algorithm>using namespace std;int num[10000];int main(){ int n,i=0,length=0,median; while(cin>>n) {原创 2017-09-14 16:35:31 · 378 阅读 · 0 评论 -
uva 10327 Flip Sort
Sorting in computer science is an important part. Almost every problem can be solved effeciently if sorted data are found. There are some excellent sorting algorithm which has already acheived the lowe原创 2017-09-14 16:39:06 · 416 阅读 · 0 评论 -
uva 10050 Hartals
题意: 输入h代表罢工的周期,给定一定的天数,默认第一天为周日,输出罢工的天数,周五和周六不算代码:#include <iostream>#include<cstring>using namespace std;int main(){ int T,i,k,P,N,h,s; cin>>T; int day[3651];//记录当天是否罢工,若罢工记为1,否则为0原创 2017-09-14 16:22:11 · 225 阅读 · 0 评论 -
uva 315 Network
A Telephone Line Company (TLC) is establishing a new telephone cable network. They are connecting several places numbered by integers from 1 to N. No two places have the same number. The lines are bidi原创 2017-09-23 18:20:23 · 233 阅读 · 0 评论 -
UVA 10706 Number Sequence
A single positive integer i is given. Write a program to find the digit located in the position i in the sequence of number groups S1S2 … Sk. Each group Sk consists of a sequence of positive integer nu原创 2017-09-23 18:27:28 · 233 阅读 · 0 评论 -
UVA 10539 Almost Prime
Almost prime numbers are the non-prime numbers which are divisible by only a single prime number. In this problem your job is to write a program which finds out the number of almost prime numbers withi原创 2017-09-23 19:04:21 · 311 阅读 · 0 评论 -
UVA 10336 Rank the Languages
You might have noticed that English and Spanish are spoken in many areas all over the world. Now it would be nice to rank all languages according to the number of states where they are spoken. You’re原创 2017-09-24 11:40:36 · 424 阅读 · 0 评论 -
UVA 10452 Marcus
“First, the breath of God. Only the penitent man will pass. Second, the Word of God, Only in the footsteps of God will he proceed. Third, the Path of God, Only in the leap from the lion’s head wil原创 2017-09-24 12:30:34 · 472 阅读 · 0 评论 -
UVA 120 Stacks of Flapjacks
Background 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 impor原创 2017-09-13 21:08:32 · 283 阅读 · 0 评论 -
POJ 1840 Eqs
Description Consider equations having the following form: a1x13+ a2x23+ a3x33+ a4x43+ a5x53=0 The coefficients are given integers from the interval [-50,50]. It is consider a solution a system (原创 2017-09-15 22:47:25 · 204 阅读 · 0 评论 -
UVA 10077 The Stern-Brocot Number System
题意: 题目:给你一颗分数组成的二叉树,初始值是1/1,两边的边界分别是0/1与1/0,然后递归建立子树节点,每个子树的节点值为两边的边界值的分子之和比上分母之和,然后将新的值也加入边界值。用二分搜索法来写#include <iostream>using namespace std;void find(int lx,int ly,int rx,int ry,int X,int Y){原创 2017-09-20 19:12:57 · 233 阅读 · 0 评论 -
uva 10596 Morning Walk
Kamal is a Motashota guy. He has got a new job in Chittagong. So, he has moved to Chittagong from Dinajpur. He was getting fatter in Dinajpur as he had no work in his hand there. So, moving to Chittago原创 2017-10-02 14:20:53 · 162 阅读 · 0 评论 -
UVA 469 Wetlands of Florida
A construction company owns a large piece of real estate within the state of Florida. Recently, the company decided to develop this property. Upon inspection of the property, however, it was revealed t原创 2017-10-02 15:55:16 · 593 阅读 · 0 评论 -
UVA 144 Student Grants
The Government of Impecunia has decided to discourage tertiary students by making the payments of tertiary grants a long and time-consuming process. Each student is issued a student ID card which has a原创 2017-10-02 16:23:23 · 475 阅读 · 0 评论 -
欧拉函数
uva 10299 计算一个给定数的欧拉函数(1~n-1中和n互质的数的个数) 欧拉函数:φ(n)= n (1 - 1/p1)(1 - 1/p2)(1 - 1/p3)…*(1 - 1/pt);这里利用筛法打表计算出50000内的素数,因为数据范围是1000000000内的#include <iostream>#include <cstring>using n...原创 2018-03-26 18:05:49 · 209 阅读 · 0 评论