摘要: 原题链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1865题目大意:输入一串字符(只有大写字母和小写字母),在字符串中,a代表1,b代表2,以此类推,z代表26,接着A代表27,B代表28,以此类推,Z代表52,将该字符串的字母值相加总和为质数的话,即为Prime Words。 1 #include<stdio.h> 2 int f(char s){ //判断字符代表的值// 3 int n; 4 if(s&g 阅读全文
posted @ 2013-02-22 11:33 sev_en 阅读(202) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1150题目大意:如图,正方形ABCD。边长AB=BC=CD=DA= a。以ABCD为圆心,a为半径画4個弧形可以把正方形切割成几个区域,若把相同形狀的区域涂上相同的背景花纹,可以知道共有3种不同的形狀区域。于是要求当输入a时求这三个形状区域的面积。解题思路:如图,四边形AFED可求,扇形AOD可求,于是DEO面积可求。四边形ABCD的面积-扇形ABC的面积=图形ACD的面 阅读全文
posted @ 2013-02-21 17:32 sev_en 阅读(618) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1281题目大意:有两个字串s,t,当移走t字串的某些字符后,如果剩下的为字串s,则输出Yes,否则输出No。刚开始定义了一个1000的数组,结果RE,然后补到10000,依旧如此,再补一个0,WA了。 1 #include<stdio.h> 2 #define M 100000 3 int main(){ 4 char s[M],a[M]; 5 int i,j 阅读全文
posted @ 2013-02-21 17:05 sev_en 阅读(308) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2474题目大意:输入三个数,判断能否构成三角形,不能则输出“Invalid”,能构成且三边均相等输出“Equilateral”,恰有两边相等则输出“Isosceles”,三遍均不相等输出“Scalene”。 1 #include<stdio.h> 2 int main(){ 3 int n,t=1; 4 long int a,b,c; 5 scanf(&quo 阅读全文
posted @ 2013-02-16 08:00 sev_en 阅读(168) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3087题目大意:输入三个数判断这三个数是否构成一个三角形,可以的话输出"OK”,否则输出"Wrong!!"。 1 #include<stdio.h> 2 int main(){ 3 int n,a,b,c; 4 scanf("%d",&n); 5 while(n--){ 6 scanf("%d 阅读全文
posted @ 2013-02-16 07:55 sev_en 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2986题目大意:输入一个奇数N,后面有N个数,且这些数必定以递增或递减顺序排列,我们的任务是找出一个数f使得比f小的数的个数总等于比f大的数的个数,即求中间数。 1 #include<stdio.h> 2 int main(){ 3 int i,n,k=1,t,a[10]; 4 scanf("%d",&n); 5 while(n-- 阅读全文
posted @ 2013-02-16 07:52 sev_en 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2113题目大意:比较大小,水题。 1 #include<stdio.h> 2 int main(){ 3 long int a,b; 4 int n; 5 scanf("%d",&n); 6 while(n--){ 7 scanf("%ld%ld",&a,&b); 8 if(a>b)prin 阅读全文
posted @ 2013-02-16 07:41 sev_en 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1753题目大意:第一列输入一个整数表示有几组测试数据,每组数据有两个整数s,d。s代表比赛结束时二队分数的总和,d代表比赛结束时分数差的绝对值。输出这两队的分数,分数大的在前面,如果没有,则输出“impossible” 1 #include<stdio.h> 2 int main(){ 3 int n,a,b,x,y,t; 4 scanf("%d&q 阅读全文
posted @ 2013-02-13 09:31 sev_en 阅读(198) 评论(-1) 推荐(0) 编辑
摘要: 原题链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1724题目大意:给出一个范围a到b,求出a与b之间所有奇数的和 1 #include<stdio.h> 2 int main(){ 3 int n,a,b,i,t,s,k=0; 4 scanf("%d",&n); 5 while(n--){ 6 scanf("%d%d",&a,&b); 7 s=0 阅读全文
posted @ 2013-02-13 09:22 sev_en 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 原题链接:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1637题目大意:輸入一個正整數N並且依據以下的規則傳回一個正整數:. 如果 N <= 100, 那麼 f91(N) = f91( f91( N+11) ). 如果 N >= 101, 那麼 f91(N) = N-10运用递归调用问题就很简单了,不过在编程中还是有一个问题,在while(scanf("%ld",&n)&& 阅读全文
posted @ 2013-02-13 09:19 sev_en 阅读(197) 评论(0) 推荐(0) 编辑