- 博客(82)
- 收藏
- 关注
原创 leetcode 2 Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link
2015-09-11 11:04:09
277
原创 UVa 658 It's not a Bug, it's a Feature!
It's not a Bug, it's a Feature! It is a curious fact that consumers buying a new software product generally do not expect the software to be bug-free. Can you imagine buying a car whose st
2015-06-22 15:54:19
478
原创 UVa 10048 Audiophobia
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=989#include #include #include using namespace std;// d[i][j]代表从第i点到第j点需要忍受的最少分贝级别//
2015-06-22 11:15:26
1212
原创 UVa 247 Calling Circles
Calling Circles If you've seen television commercials for long-distance phone companies lately, you've noticed that many companies have been spending a lot of money trying to convince peop
2015-06-22 10:52:49
331
原创 UVa 1395 Slim Span
Given an undirected weighted graph G , you should find one of spanning trees specified as follows.The graph G is an ordered pair (V, E) , where V is a set of vertices {v1, v2,..., vn} and E is a s
2015-06-21 19:45:08
311
原创 UVa 11346 Probability
G - ProbabilityTime Limit: 1 sec Memory Limit: 16MBConsider rectangular coordinate system and point L(X,Y) which is randomly chosen among all points in the area A which is defined in the fol
2015-06-20 16:19:03
300
原创 UVa 10288 Coupons
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1229#include #include #include #include #include using namespace std;// result[i]
2015-06-20 15:33:39
323
原创 UVa 1638 Pole Arrangement
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4513#include #include long long d[22][22][22];int main(){ memset(d, 0, sizeof(d))
2015-06-15 21:03:02
300
原创 UVa 1637 Double Patience
Double Patience is a single player game played with a standard 36-card deck. The cards are shuffled and laid down on a table in 9 piles of 4 cards each, faces up.After the cards are laid down, the p
2015-06-14 15:35:58
288
原创 UVa 1636 Headshot
You have a revolver gun with a cylinder that has n chambers. Chambers are located in a circle on a cylinder. Each chamber can be empty or can contain a round. One chamber is aligned with the gun's bar
2015-06-13 15:42:33
372
原创 UVa 1635 Irrelevant Elements
Young cryptoanalyst Georgie is investigating different schemes of generating random integer numbers ranging from 0 to m - 1. He thinks that standard random number generators are not good enough, so
2015-06-12 15:43:00
244
原创 UVa 10791 Minimum Sum LCM
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1732#include #include // 对该数进行质因数分解的质数及其指数的和long long sum;long long x;bool is_pr
2015-06-11 10:43:21
266
原创 UVa 10375 Choose and divide
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1316#include #include #include #include using namespace std;// 10000以内的所有素数// arra
2015-06-10 14:56:04
280
原创 UVa 11582 Colossal Fibonacci Numbers!
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2629#include #include #include using namespace std;int n;unsigned long long a, b;
2015-06-09 23:21:49
263
原创 UVa 10271 Chopsticks
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1212#include #include #include using namespace std;// record[i][j]代表从第i,i+1,...,n个筷
2015-06-09 11:15:18
293
原创 UVa 12589 Learning Vector
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4034#include #include #include using namespace std;// record[i][j][k]代表当前形成高度为k, 从第i
2015-06-08 19:23:19
328
原创 UVa 10163 Storage Keepers
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1104#include #include #include #include using namespace std;// s[i][j]代表从第i,i+1,...
2015-06-07 19:47:36
281
原创 UVa 1632 Alibaba
Alibaba the famous character of our childhood stories would like to be immortal in order to keep bringing happiness to children. In order to rich this status he needs to prove that he is still able to
2015-06-06 16:49:16
355
原创 UVa 10723 Cyborg Genes
Problem FCyborg GenesTime Limit1 SecondSeptember 11, 2132.This is the day that marks the beginning of the end – the end of you the miserable humans. For years you hav
2015-06-06 10:44:33
373
原创 UVa 242 Stamps and Envelope Size
Stamps and Envelope Size Philatelists have collected stamps since long before postal workers were disgruntled. An excess of stamps may be bad news to a country's postal service, but good n
2015-06-05 22:41:22
371
原创 UVa 10118 Free Candies
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1059#include #include #include using namespace std;// record[a][b][c][d]代表第1,2,3,4堆取
2015-06-04 15:36:27
266
原创 UVa 1336 Fixing the Great Wall
The Great Wall of China is truly one of the greatest wonders of the world. In 3-rd century BC, Emperor Qin Shi Huang connected the defensive structures built earlier by the states of Qin, Yan, and Zha
2015-06-04 10:57:22
834
原创 UVa 10934 Dropping water balloons
Problem A: Dropping water balloonsIt's frosh week, and this year your friends have decided that they would initiate the new computer science students by dropping water balloons on them. They've fill
2015-06-03 16:46:22
314
原创 UVa 1252 Twenty Questions
Consider a closed world and a set of features that are defined for all the objects in the world. Each feature can be answered with ``yes" or ``no". Using those features, we can identify any object fro
2015-06-02 23:10:05
294
原创 UVa 10817 Headmaster's Headache
#include #include #include #include #include #include #include #include using namespace std;#define inf (1<<30)// 申请人结构体typedef struct node{ int cost; // 薪水 vector sub; // 可以教的课程编号 }n
2015-06-02 12:30:22
270
原创 UVa 1218 Perfect Service
题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3659#include #include #include #include using namespace std;#define inf (1<<30)//
2015-06-01 21:21:54
276
原创 UVa 1220 Party at Hali-Bula
Dear Contestant,I'm going to have a party at my villa at Hali-Bula to celebrate my retirement from BCM. I wish I could invite all my co-workers, but imagine how an employee can enjoy a party whe
2015-06-01 19:50:01
278
原创 UVa 1331 Minimax Triangulation
Triangulation of surfaces has applications in the Finite Element Method of solid mechanics. The objective is to estimate the stress and strain on complex objects by partitioning them into small simple
2015-05-27 16:41:55
312
原创 UVa 1626 Brackets sequence
Let us define a regular brackets sequence in the following way:Empty sequence is a regular sequence.If S is a regular sequence, then (S) and [S] are both regular sequences.If A and B are regular s
2015-05-27 12:18:53
258
原创 UVa 11584 Partitioning by Palindromes
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2631#include #include int n;char str[1010];// d[i]代表将str[0...i]分组的最小组数int d[1010];bo
2015-05-25 22:53:08
251
原创 UVa 12563 Jin Ge Jin Qu hao
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=4008#include #include #include #include using namespace std;// my_map[(i,j)]代表从第i,i+1
2015-05-24 21:08:47
352
原创 UVa 1025 A Spy in the Metro
Secret agent Maria was sent to Algorithms City to carry out an especially dangerous mission. After several thrilling events we find her in the first station of Algorithms City Metro, examining the tim
2015-05-23 16:55:53
243
原创 UVa 1623 Enter The Dragon
The capital of Ardenia is surrounded by several lakes, and each of them is initially full of water. Currently, heavy rainfalls are expected over the land. Such a rain falls to one of the lakes: if the
2015-05-20 12:07:15
425
原创 UVa 1619 Feel Good
Bill is developing a new mathematical theory for human emotions. His recent investigations are dedicated to studying how good or bad days influent people's memories about some period of life.A new i
2015-05-19 12:22:11
336
原创 UVa 1616 Caravan Robbers
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=845&page=show_problem&problem=4491#include #include #include #include using namespace std;pair array[
2015-05-18 21:10:10
570
1
原创 UVa 10570 Meeting with Aliens
Problem DMeeting with AliensInput: Standard InputOutput: Standard OutputTime Limit: 3 Seconds The aliens are in an important meeting just before landing on the earth. All the aliens sit ar
2015-05-12 16:24:40
365
原创 UVa 1615 Highway
Bob is a skilled engineer. He must design a highway that crosses a region with few villages. Since this region is quite unpopulated, he wants to minimize the number of exits from the highway. He model
2015-05-11 19:28:01
354
原创 UVa 1614 Hell on the Markets
Most financial institutions had become insolvent during financial crisis and went bankrupt or were bought by larger institutions, usually by banks. By the end of financial crisis of all the financial
2015-05-10 16:09:52
543
原创 UVa 1613 K-Graph Oddity
You are given a connected undirected graph with an odd number of vertices. The degree of the vertex, by definition, is the number of edges incident to it. In the given graph the degree of each vertex
2015-05-10 11:31:25
1470
原创 UVa 11925 Generating Permutations
题目链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3076#include #include #include using namespace std;int next[310];int prev[310];int
2015-05-09 12:22:59
307
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人