摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=24&problem=979&mosmsg=Submission+received+with+ID+11308688题意为输入3000个以内的一组数,判断相邻两个的差值的绝对值是否满足1到n-1,并且都只出现一次,注意当只输入数字只有一个时也是jollyView Code 1 #include<stdio.h> 2 #include<math.h& 阅读全文
posted @ 2013-02-19 16:22 执着追求的IT小小鸟 阅读(102) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=24&problem=72&mosmsg=Submission+received+with+ID+11308364寻找丑数,因子里只有2,3,5的数叫做丑数,找出第1500个丑数,首先想到可以一个一个判断,后来发现TLE了,所以应该从1开始,逐个乘以2,3,5,然后得到不重复的最小数,重复此步骤就可得到结果View Code 1 #include<stdio. 阅读全文
posted @ 2013-02-19 15:07 执着追求的IT小小鸟 阅读(97) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=24&problem=318&mosmsg=Submission+received+with+ID+11308210因子和大于自身输出ABUNDANT,因子和等于自身输出PERFECT,因子和小于自身输出DEFICIENT,输出时注意按格式输出View Code 1 #include<stdio.h> 2 int main() 3 { 4 int a,i 阅读全文
posted @ 2013-02-19 14:32 执着追求的IT小小鸟 阅读(222) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=24&problem=38&mosmsg=Submission+received+with+ID+11307365三个盒子,放九样东西,把相同颜色的放一块,这其中会移动一些东西,移动的次数最少的为结果,如果出现多种移动方法,就按字典序输出第一个View Code 1 #include<stdio.h> 2 #include<string.h> 阅读全文
posted @ 2013-02-19 10:55 执着追求的IT小小鸟 阅读(214) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=959输入一个整数,如果不是回文数,就倒序成另一个数,然后加到原来的数里面,知道出现回文数,输出步骤数及第一个出现的回文数View Code 1 #include<stdio.h> 2 #include<string.h> 3 int rev(char *s)//这个函数判断字符串是否符合条件 4 { 5 char ss[100 阅读全文
posted @ 2013-02-19 10:09 执着追求的IT小小鸟 阅读(83) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=976输入两个数,做加法,求加法过程中的进位次数,字符串接收,用高精度做View Code 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 int i,j,l,lena,lenb; 6 char a[100],b[100]; 7 int ans[12]; 8 阅读全文
posted @ 2013-02-19 09:59 执着追求的IT小小鸟 阅读(109) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=24&problem=996&mosmsg=Submission+received+with+ID+11307262计算士兵数差值,即大减小,可以用绝对值,也可以先判断大小,再做运算View Code 1 #include<stdio.h> 2 int main() 3 { 4 int a,b,t; 5 while(scanf("%d%d&qu 阅读全文
posted @ 2013-02-19 09:57 执着追求的IT小小鸟 阅读(86) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1012回到学校物理,简单的速度乘时间,然后再double,主要要看懂题目View Code 1 #include<stdio.h> 2 int main()3 {4 int a,b;5 while(scanf("%d%d",&a,&b)!=EOF)6 printf("%d\n",2* 阅读全文
posted @ 2013-02-19 09:52 执着追求的IT小小鸟 阅读(87) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1020切披萨的问题,写出前十个数,推出通项公式1+n*(n+1)/2,即可解答View Code 1 #include<stdio.h>2 int main()3 {4 long long n;5 while(scanf("%lld",&n)&&n>=0)6 printf("%l 阅读全文
posted @ 2013-02-19 09:50 执着追求的IT小小鸟 阅读(129) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1241这里是农夫耕地和农作物密度的问题,面积相乘再相加即可View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 int main() 4 { 5 int n,f,i,a,sum,b,c; 6 scanf("%d",&n); 7 while(n--) 阅读全文
posted @ 2013-02-19 09:46 执着追求的IT小小鸟 阅读(72) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1281这题是判断前一个字符串能否在后一个字符串中按顺序找出来,并不一定要连续,但要按顺序,并全部找到,可以将二者一一对应,如果前一个字符串能全部按顺序对应,就可以,否则不行View Code 1 #include<stdio.h> 2 #include<string.h> 3 char s[1000010],t[1000010 阅读全文
posted @ 2013-02-19 09:37 执着追求的IT小小鸟 阅读(116) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1287彼得的烟抽完剩下烟头,输入香烟n和k个烟头可以卷成一根新的香烟,然后求总的可以抽的香烟数,只要循环到最后的烟头数小于k就可以了View Code 1 #include<stdio.h> 2 int main() 3 { 4 int n,k,yt,yl; 5 while(scanf("%d%d",&n,&a 阅读全文
posted @ 2013-02-19 09:29 执着追求的IT小小鸟 阅读(115) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1361这题是关于旅游点的名胜清单,输入国家名和景点,计算各个国家的景点数,保留不重复的,重复的就在原来的基础上加上一,最后输出时注意按字典序输出#include<stdio.h>#include<string.h>struct country{ char name[100]; int sum; };/... 阅读全文
posted @ 2013-02-19 09:24 执着追求的IT小小鸟 阅读(123) 评论(0) 推荐(0) 编辑
摘要: http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1365爱的计算,把两个人的名字中的各个字母分别对应1到26,并相加,分别记和,最后二人和的比就是爱的结果,注意这个结果不超过100%View Code 1 #include<stdio.h> 2 #include<string.h> 3 void zhuanhua(char *s)//把大写改成小写 4 { 5 while(* 阅读全文
posted @ 2013-02-19 09:20 执着追求的IT小小鸟 阅读(126) 评论(0) 推荐(0) 编辑