
UVa
文章平均质量分 81
ACM2272902662
这个作者很懒,什么都没留下…
展开
-
UVa 11437 - Triangle Fun
该学一下用向量求交点坐标了。#include #include #include #include #include #include #define eqs 1e-8using namespace std;double a = 2.0/3;double b = 1.0/3;int main(){ //freopen("data.txt","r",stdin);原创 2014-04-18 00:25:54 · 2595 阅读 · 0 评论 -
UVa 644 - Immediate Decodability
一个二进制数是其他的二进制数的任何一个的前缀,就输出no,都不是前缀就输出yes。#include #include int main(){ int i,j,n,m,s,t,l1,l2,x; char s1[100][100]; int flag=1; while(scanf("%s",s1[0])!=EOF) { for(i=1;原创 2012-04-20 15:32:57 · 603 阅读 · 0 评论 -
1260. Nudnik Photographer
我在做这道题的时候首先用的是回溯法,但是交上地 时候显示超时,下面我把用回溯法的代码贴出来。#include #include int n,flag=0;int b[100],a[100];int main(){ void f(int x); int i,j,m,t; scanf("%d",&n)!=EOF flag=0; fo原创 2012-05-10 17:53:08 · 778 阅读 · 0 评论 -
UVa 10420 - List of Conquests
做这道题目完全就是字符串的比较,包含的过程如下:1:判断出现的国家在前面是否已经出现过,如果出现了,则要比较后面的人名是不是一样,如果一 样,就不用再计数了,不一样则要在s2中寻找该国家在对应的位置(a中)上+1。2:如果没有出现 需要在s2 中曾加这个国家,并使对应的整形数组(a中)位置初始化为1.3:对s2进行排序,在两个字符串进行对调的时候a中对应的位置也应对调。原创 2012-05-11 16:41:48 · 982 阅读 · 0 评论 -
10494 If We Were a Child Again
这道题目的思路就是用数组将除法模拟一下,一次取出各位进行除法,商一次存储在整型数组中,将余数与下一位结合,此处的用的类型为long long int 以免在余数在与下一位结合的时候造成数据的溢出,至于为什么用long long int 可以防止溢出是因为在与下一位结合的时候其最大位数是 int 型最大位数+1,因此用long long int 可以。最后的余数是整体的余数,数组中的数合起来是商。原创 2012-05-22 22:05:15 · 782 阅读 · 0 评论 -
UVa 10420 - List of Conquests
Problem BList of ConquestsInput:standard inputOutput: standard outputTime Limit: 2 secondsIn Act I, Leporello is telling Donna Elvira about his master's long list of conquests:``This is th原创 2012-05-31 18:51:10 · 752 阅读 · 0 评论 -
UVa 11044 - Searching for Nessy
Searching for Nessy The Loch Ness Monsteris a mysterious and unidentified animal said to inhabit Loch Ness, a large deep freshwater loch near the city of Inverness in northern Scotland.原创 2012-10-13 18:45:37 · 761 阅读 · 0 评论 -
UVa 10499 - The Land of Justice
Problem HThe Land of JusticeInput: standard inputOutput: standard outputTime Limit: 4 secondsIn the Land of Justice the selling price of everything is fixed all over the country. Nobody原创 2012-10-13 16:01:02 · 856 阅读 · 0 评论 -
UVa Triangle Wave
这道题目可以说是不能,但仍然wrong了好几次,一定不要忘了最后一组不输出空行,否则显示的是wrong,而不是格式错误,下面是我的代码:#include #include int main(){ int i,j,n,m,x,y; scanf("%d",&n); while(n--) { scanf("%d %d",&x,&y); for(i=1;i<=y;i++) {原创 2012-04-05 18:44:05 · 671 阅读 · 0 评论 -
UVa 10115 - Automatic Editing
这道题目英文叙述了很多,其实就是对于给出的查找字符串,在让改变的字符串中改变部分字符,就是数组字符的前移与后移问题#include #include int main(){ int i,j,n,m,s,t,x,y,z,k; char s1[1000][1000]; char s2[1000]; int l1,l2,l; while(scanf("%原创 2012-04-20 23:02:08 · 875 阅读 · 0 评论 -
UVa 340 - Master-Mind Hints
Master-Mind Hints MasterMind is a game for two players. One of them, Designer, selects asecret code. The other,Breaker, tries to break it. A code is no morethan a row of colored dots. At t原创 2012-05-31 21:57:23 · 909 阅读 · 0 评论 -
UVa 10110 - Light, more light
Light, more lightThe ProblemThere is man named "mabu" for switching on-off light in our University. He switches on-off the lights in a corridor. Every bulb has its own toggle switch. That原创 2012-10-12 21:11:35 · 669 阅读 · 0 评论 -
UVa 490 - Rotating Sentences
我在做此题的的时候,用一个整型数组来存储每一个输入字符串的长度,在输入的时候,计算出最长的字符串。在输出的时候,如果控制列数的变量数值大于字符串的长度,就输出空格,否则就输出字符串所对应列数的字符。代码如下:#include #include int main(){ int i,j,n,l,max; char s1[100][100]; int a[100]; i=0;原创 2012-04-03 17:14:13 · 1129 阅读 · 0 评论 -
UVa Hangman Judge
这道题目很容易出错,注意输入,例如输入cheese 和cheese也应该是you win。我们在编写程序的时候,很容易忽略后者的字符串中有重复元素。从而造成wrong answer。下面是我的代码:#include #include int main(){ int i,j,n,s3,s4,l1,l2,k,k1; char s1[1000],s2[1000]; while(sca原创 2012-04-05 20:22:33 · 537 阅读 · 0 评论 -
UVa 401 - Palindromes
这道题目,题意很容易懂,就是条件很苛刻,请注意在判断的回文串的时候,字母‘O’与数字‘0’ 看成是同一个字符,彼此等价,这是应注意的第一点,其次是在判断是否是mirrored string的时候,进行的第一个操作是进行转化,转化完成后,在按题意与原字符串比较,进行比较的时候,也要注意字母‘O’与数字‘0’的等价关系; 第三点要注意的是 在输出的时候,每个输出的行下面要对应一个空行,只要注意这些,这原创 2012-04-10 15:12:17 · 941 阅读 · 0 评论 -
UVa 10010 - Where's Waldorf?
其实这道题目,只要是明白了意思,实现起来很简单,不需要什么高深的算法,但却很容易出错,尤其在处理从八个方向比对字符串的时候,要注意各个量的变化,变了的要进行还原,最后去最值的时候,有两个过程,一是选行最小的那个,二是如果两个开头的字母所在的行相同的时候,要在进行比较列的大小,选列小的那个。 在使用的全局变量的时候,在定义局部变量的时候,不要重复定义,否则编译时虽然不会出错,在运行出结果的原创 2012-04-13 17:07:17 · 810 阅读 · 0 评论 -
UVa 10361 - Automatic Poetry
其实 这都题目并不难,就是简单处理字符串的问题,不过有一点要注意的是,在取s2,s3,s4,s5的时候,空格也是其中的一部分。下面是我的代码:#include #include int main(){ int i,j,n,x,key,key1; int flag; char s1[1000][100]; char s2[100],s3[100],s4[100],s5[10原创 2012-04-13 22:49:21 · 753 阅读 · 0 评论 -
UVa 537 - Artificial Intelligence?
#include #include int main(){ int i,j,n,l,k1,k2,k3,x,flag1,flag2,flag3,flag4,z,key; char s1[10000],s2[100],s3[100]; int l1,l2; double U,I,P,s,t; scanf("%d",&n); getchar(); z=1; while(n--)原创 2012-04-15 23:02:29 · 835 阅读 · 0 评论 -
UVa 10719 - Quotient Polynomial
Problem BQuotient PolynomialTime Limit2 SecondsA polynomial of degree n can be expressed asIf k is any integer then we can write:Here q(x) is called the quotien原创 2012-10-13 20:29:04 · 724 阅读 · 0 评论 -
10167 - Birthday Cake
Problem G. Birthday Cake BackgroundLucy and Lily are twins. Today is their birthday. Mother buys a birthday cake for them.Now we put the cake onto a Descartes coordinate. Its center is原创 2012-09-25 10:55:38 · 1035 阅读 · 0 评论 -
UVa 270 - Lining Up
Lining Up ``How am I ever going to solve this problem?" said the pilot.Indeed, the pilot was not facing an easy task. She had to drop packages at specific points scattered in a dangero原创 2013-03-01 16:03:23 · 758 阅读 · 0 评论 -
UVa 10057 - A mid-summer night's dream.
Problem CA mid-summer night’s dreamInput: standard inputOutput: standard output This is year 2200AD. Science has progressed a lot in two hundred years. Two hundred years is mentioned here原创 2013-03-01 20:39:58 · 794 阅读 · 0 评论 -
POJ 10341 - Solve It
Problem FSolve ItInput: standard inputOutput: standard outputTime Limit: 1 secondMemory Limit: 32 MBSolve the equation: p*e-x + q*sin(x) + r*cos(x) + s*tan(x) + t*x2 + u = 0原创 2013-03-01 17:31:33 · 800 阅读 · 0 评论 -
UVa 10132 - File Fragmentation
Question 2: File FragmentationThe ProblemYour friend, a biochemistry major, tripped while carrying a tray of computer files through the lab. All of the files fell to the ground and broke. Your fri原创 2013-03-01 13:28:48 · 885 阅读 · 0 评论 -
UVa 12596 - Recursive Texting
Problem ERecursive TextingAll of you have typed in mobile phones. In this problem, you will have to do a similar thing.You are given a word. You will have to process it. There are two phases i原创 2013-03-12 00:39:25 · 1405 阅读 · 0 评论 -
Problem E - Camel trading
Problem E - Camel tradingTime Limit: 1 secondBackgroundAroud 800 A.D., El Mamum, Calif of Baghdad was presented the formula 1+2*3*4+5, which had its origin in the financial accounts of a c原创 2013-03-07 20:30:58 · 1147 阅读 · 0 评论 -
UVa 10340 - All in All
Problem EAll in AllInput: standard inputOutput: standard outputTime Limit: 2 secondsMemory Limit: 32 MBYou have devised a new encryption technique whichencodes a message by inserting betwe原创 2013-03-06 21:27:23 · 1032 阅读 · 0 评论 -
UVa 10706 - Number Sequence
Problem BNumber SequenceInput: standard inputOutput: standard outputTime Limit: 1 secondA single positiveinteger iis given. Write a program to find the digitlocated in the positioniin原创 2013-03-06 21:13:06 · 944 阅读 · 0 评论 -
UVa 10487 - Closest Sums
Problem DClosest SumsInput: standard inputOutput: standard outputTime Limit: 3 seconds Given is a set of integers and then a sequence of queries. A query gives you a number and asks to fin原创 2013-03-04 20:39:48 · 853 阅读 · 0 评论 -
UVa 10905 - Children's Game
4thIIUCInter-University Programming Contest, 2005AChildren’s GameInput: standard inputOutput: standard outputProblemsetter: Md. KamruzzamanThere a原创 2013-01-30 19:39:00 · 890 阅读 · 0 评论 -
UVa 10763 - Foreign Exchange
Problem EForeign ExchangeInput: standard inputOutput: standard outputTime Limit: 1 secondYour non-profit organization (iCORE - internationalConfederation of Revolver Enthusiasts) coord原创 2013-01-30 21:14:45 · 774 阅读 · 0 评论 -
UVa 839 - Not so Mobile
Not so MobileBefore being an ubiquous communications gadget, a mobile was just a structure made of strings and wires suspending colourfull things. This kind of mobile is usually found ha原创 2012-11-24 19:21:47 · 585 阅读 · 0 评论 -
UVa 10061 - How many zero's and how many digits ?
Problem GHow many zeros and how many digits?Input: standard inputOutput: standard outputGiven a decimal integer number you will have to find out how many trailing zeros will be there in原创 2012-10-18 17:51:48 · 1496 阅读 · 0 评论 -
UVa 10004 - Bicoloring
Bicoloring In 1976 the ``Four Color Map Theorem" was proven with the assistance of a computer. This theorem states that every map can be colored using only four colors, in such a way that原创 2012-10-17 10:48:21 · 763 阅读 · 0 评论 -
UVa 550 - Multiplying by Rotation
Multiplying by Rotation Warning: Not all numbers in this problem are decimal numbers!Multiplication of natural numbers in general is a cumbersome operation. In some cases however the原创 2012-10-16 20:52:34 · 1170 阅读 · 0 评论 -
UVa 10129 - Play on Words
Play on WordsSome of the secret doors contain a very interesting word puzzle. The team of archaeologists has to solve it to open that doors. Because there is no other way to open the doors, the puzz原创 2012-09-25 15:08:55 · 756 阅读 · 0 评论 -
UVa 409 - Excuses, Excuses!
看题目的时候,我在想一个问题,这个问题的字母的大小写是不是等价的当看到第一个样例后就会知道,这个问题的大小写也是的等价的。 对于一个字符串中重复出现的单词,不进行重复计数。还有就是尽量把数组定义的大一些,否则会出先runtime error。下面是我的代码:#include #include int main(){ int i,j,n,m,s,t,x,z,max,l,flag,ke原创 2012-04-16 22:49:25 · 687 阅读 · 0 评论 -
UVa 424 - Integer Inquiry
这道题目就是大整数的相加,类似于给你一个很大的数求阶乘,起主导思想是一样的,说不清楚,看代码吧:#include #include int main(){ int i,j,n,m,t,s,flag1,flag2,x,max,k,flag3; char s1[1000]; int a[100][100],b[100000]; int l; flag1原创 2012-04-22 09:58:41 · 947 阅读 · 0 评论 -
UVa 10106 - Product
#include #include char s1[1000],s2[1000];int s3[10000];int main(){ int i,j,n,m,t,l1,l2,x,flag,z,k,w,s; while(scanf("%s %s",s1,s2)!=EOF) { x=0; flag=0; l1=strl原创 2012-04-25 22:11:43 · 680 阅读 · 0 评论 -
UVa 573 - The Snail
The Snail A snail is at the bottom of a 6-foot well and wants to climb to the top. The snail can climb 3 feet while the sun is up, but slides down 1 foot at night while sleeping. The snail原创 2012-07-24 15:42:55 · 638 阅读 · 0 评论