2013年2月25日
摘要: 题目链接http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1287规律题,通过计算可知道总烟数n=a1+a1/a2和n=a1+a1/a2-1#include"stdio.h"int main(){ int apple,pea,orange; while(scanf("%d%d",&apple,&pea)!=EOF) { if(apple%(pea 阅读全文
posted @ 2013-02-25 17:50 秒速5CM 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 题目链接http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=24&problem=1241&mosmsg=Submission+received+with+ID+11339336每个事件每一行的第一和第三相乘,总的相加即可#include"stdio.h"int main(){ int apple,pea,orange,tomato,grape,potato; scanf("%d&quo 阅读全文
posted @ 2013-02-25 17:49 秒速5CM 阅读(161) 评论(0) 推荐(0) 编辑
摘要: 题目链接http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1020规律题,通过计算可以知道每条线穿过最多条线可以切出最多块。穿过n条线会增加n+1块#include"stdio.h"int main(){ long long a,b; while(scanf("%lld",&a)&&a>=0) { b= 1+n*(n+1)/2; p 阅读全文
posted @ 2013-02-25 17:47 秒速5CM 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 题目链接http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=72这题我的解法,逐个把2,3,5.三个元素逐一剔除,如果结果为1那这个数就为丑陋数。当然这种方法超时了,在自家电脑运行了快一分钟才算出来。求大神,以下是超时版本#include"stdio.h"#include"conio.h"int main(){ int pea,banana,tomato=15,a 阅读全文
posted @ 2013-02-25 16:19 秒速5CM 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 题目链接http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=2113判断两个数的大小关系,并用关系运算符表示出来#include"stdio.h"int main() { long int banana,apple,pea; scanf("%d",&banana); while(banana--) { scanf("%d %d",&am 阅读全文
posted @ 2013-02-25 07:26 秒速5CM 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 题目链接http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1724本题是要求给定区间的奇数和,我的解法:首先判断左边的数是否为奇数,是的话直接赋值给K,不是的话+1赋值给K.然后K每次自增2并与前一次相加,满足K小于或等于右边,循环#include"stdio.h"int main(){ int t,i,j,k,sum[100]; int a[100][2]; scanf(&quo 阅读全文
posted @ 2013-02-25 07:19 秒速5CM 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 题目链接http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1023键盘输入的变换,目测可以用来恶作剧。用的是土方法#include"stdio.h"int main(){ char apple; while(scanf("%c",&apple)!=EOF) { if(apple=='=') printf("-"); e 阅读全文
posted @ 2013-02-25 07:17 秒速5CM 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 题目链接http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1012不解释#include"stdio.h" int main() { int v,t; while(scanf("%d %d", &v,&t) != EOF) printf("%d\n", 2*v*t); return 0; } 阅读全文
posted @ 2013-02-25 07:10 秒速5CM 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 题目链接http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=24&problem=49&mosmsg=Submission+received+with+ID+11335297算对数开始天真的认为简单的做个循环就搞定,呵呵!最后那组一直实现不了。多亏了高人指点,多学了两个函数#include"stdio.h"#include"math.h"int main(){ double a 阅读全文
posted @ 2013-02-25 00:07 秒速5CM 阅读(191) 评论(0) 推荐(0) 编辑