摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1637根据题意给出的公式,运用递归函数,求出结果View Code 1 #include<stdio.h> 2 int f91(int n) 3 { 4 if(n<=100) 5 return f91(f91(n+11)); 6 else if(n>=101) 7 return n-10;//自定义递归函数 8 } 9 int 阅读全文
posted @ 2013-02-18 16:59
执着追求的IT小小鸟
阅读(69)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1724将两数之间的所有奇数加起来,得到结果View Code 1 #include<stdio.h> 2 int main() 3 { 4 int a,b,sum,i,n; 5 scanf("%d",&n); 6 for(i=1;i<=n;i++) 7 { 8 sum=0;//和要先初始化 9 scanf 阅读全文
posted @ 2013-02-18 16:58
执着追求的IT小小鸟
阅读(56)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1862根据题目给的数字符号字母组合,数字和符号不变,将字母与相应的数字进行转换,输出电话号码View Code 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 int a,i; 6 char str[50]; 7 while(scanf("%s& 阅读全文
posted @ 2013-02-18 16:56
执着追求的IT小小鸟
阅读(116)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1865把题目给出的字母所对应的值加起来,再判断是否是prime number 即素数 1 #include<stdio.h> 2 #include<math.h> 3 int main()//把字母所对应的值加起来,再判断是否是prime number 即素数 4 { 5 int a,i,flag; 6 char str[50 阅读全文
posted @ 2013-02-18 16:53
执着追求的IT小小鸟
阅读(71)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/external/104/10469.html这道题目中的计算方法其实就是位运算中的异或计算View Code 1 #include<stdio.h>2 #include<stdlib.h>3 int main()4 {5 int a,b;6 while(scanf("%d%d",&a,&b)!=EOF)7 printf("%d\n",a^b); // "Mofiz way"其实就是异或的运算方法8 return 0;9 } 阅读全文
posted @ 2013-02-18 16:43
执着追求的IT小小鸟
阅读(71)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=949输入几个句子,然后求出每个字母所出现的次数,按格式输出View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<conio.h> 4 void zhuanhua(char *s)//把小写字母转化为大写字母 5 { 6 int i; 7 for( 阅读全文
posted @ 2013-02-18 16:36
执着追求的IT小小鸟
阅读(155)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1870题意为判断一个数是否能被11整除,这里用割减法,存为数组,再从高位开始,一次减去11,看是否能减完View Code 1 #include<stdio.h> 2 #include<string.h> 3 void zhuanhua(char *s,int *a) 4 { 5 int i=0; 6 while(*s) 7 阅读全文
posted @ 2013-02-18 16:33
执着追求的IT小小鸟
阅读(151)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=1911怎么把一大块巧克力切开,分为一小块,一小块,先切行,再切列,得到的就是步骤数了#include<stdio.h>int main(){ int m,n; while(scanf("%d%d",&m,&n)!=EOF) printf("%d\n",(m-1)+m*(n-1));/ 阅读全文
posted @ 2013-02-18 16:13
执着追求的IT小小鸟
阅读(67)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=635这题是100的延伸,给一个数,和一个限制,求出这个数会停在规定步骤的第二步,或者超出限制数,最后#include<stdio.h>int main(){ long long a,b,n,js=1,A;//因题目给出的数据较大,所以用long long while(scanf("%lld%lld",&A,&a 阅读全文
posted @ 2013-02-18 16:09
执着追求的IT小小鸟
阅读(147)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=627所有大于4的偶数都是两个素数之和,依次判断这样不重复的素数对,并输出View Code 1 #include<stdio.h> 2 #include<math.h> 3 int yanzheng(int a)//这个函数判断a是否为素数 4 { 5 int i,flag=0; 6 for(i=2;i<=sqrt(a) 阅读全文
posted @ 2013-02-18 16:03
执着追求的IT小小鸟
阅读(181)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=532先求出平均数,然后所有低于平均数的盒子数总和就是所求结果View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 int main()//平均数以下的需要多少,就是最低多少 4 { 5 int n,i,a[100],sum,ave,j,ans; 6 for(i=1;;i++) 阅读全文
posted @ 2013-02-18 15:59
执着追求的IT小小鸟
阅读(73)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=516本题在于进制之间的转换,十进制换其他进制就除k取余法,反之则加余乘kView Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<math.h> 4 void zhuanhua(char *s,int *a)//把字符转化为数组存入数组 5 { 6 阅读全文
posted @ 2013-02-18 15:56
执着追求的IT小小鸟
阅读(94)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=482在输入的数据中计算行的和,如果是奇数,记下出现的次数,计算列的和,如果是奇数,记下出现的次数,没有奇数,说明是pairity property,只出现一次奇数,则说明可以改View Code 1 #include<stdio.h> 2 #define MAX 100 3 int main() 4 { 5 int i,j,m[MAX][ 阅读全文
posted @ 2013-02-18 15:39
执着追求的IT小小鸟
阅读(105)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=440题意是求出字符串中出现次数最多的字母,并求出字母出现的次数,注意字母可能多个#include<stdio.h>#include<string.h> int jisuan(char *s,int *i){ int k=0; char ss=*s; while((*s)==ss) { s++; k++; (*i)++; } ( 阅读全文
posted @ 2013-02-18 15:36
执着追求的IT小小鸟
阅读(112)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=435从每个单词开始计数,然后跳过这个单词,接下去循环,计数知道结束#include<stdio.h>#include<stdlib.h> char str[10000]; void guodu(int *i)//此函数用于过度到单词结束 { while(str[*i]>='A'&&str[ 阅读全文
posted @ 2013-02-18 15:31
执着追求的IT小小鸟
阅读(113)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=424从每个单词开始到遇到空格或回车换行,依次倒序输出,其中还包括符号#include<stdio.h> #include<stdlib.h>#include<string.h>void shuchu(char *s,int *i)//当不是空格是倒序输出{ char temp[100]; int j=0; whil 阅读全文
posted @ 2013-02-18 15:27
执着追求的IT小小鸟
阅读(153)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=418这题跟476差别不多,只多一个存储圆形,计算点到圆心的距离并和半径比较,判断是否在圆内#include<stdio.h>//思路跟476基本一样,而且本题代码可以解476,不同之处在于本题要多一个结构体储存circle#include<string.h>#include<stdlib.h>#include< 阅读全文
posted @ 2013-02-18 15:24
执着追求的IT小小鸟
阅读(334)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=417这题是给出某几个矩形的长和宽的坐标,然后输入点判断点是否在那些矩形里面,其中的x,y有些没按顺序输入 要自己调整View Code 1 #include<stdio.h>//本题关键在于输入给的数据只按xy的顺序,两个xy没按顺序 2 #include<string.h> 3 struct rec{ 4 double x1 阅读全文
posted @ 2013-02-18 14:55
执着追求的IT小小鸟
阅读(256)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=399这题不太理解,只单纯把上面字母对应的ascii码减去下面的,得到差值,然后,依次得到结果View Code 1 #include<stdio.h> 2 void zhuanhua(char *s) 3 { 4 while(*s) 5 { 6 (*s)=(*s)-7; 7 s++; 8 } 9 }10 int main()11 {12 阅读全文
posted @ 2013-02-18 14:51
执着追求的IT小小鸟
阅读(63)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=286本题类似于做一个随机数产生器,利用l=(z*l+i)%m产生出l,然后保留l,直到l再次出现,循环中要特别注意But be careful:the cycle might not begin with the seed!,就是第一个l不保存View Code 1 #include<stdio.h> 2 int j,len; 3 lon 阅读全文
posted @ 2013-02-18 14:46
执着追求的IT小小鸟
阅读(110)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=386按题目给出的字母和符号作出迷宫,遇到\0和!就换行,遇到将字母前的数字叠加为n,然后输出n个数字后面的那个字母,其中b代表空格View Code 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 int i,j,sum; 6 char str[10000 阅读全文
posted @ 2013-02-18 14:13
执着追求的IT小小鸟
阅读(127)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=365本题类似于udoj上的A+B2,是大数相加的问题,用高精度,把数字用字符串接收,然后放入数组依次想加再输出View Code 1 #include<stdio.h>//本题类似于A+BⅡ 2 #include<stdlib.h> 3 #include<string.h> 4 void zhuanhua(char 阅读全文
posted @ 2013-02-18 11:19
执着追求的IT小小鸟
阅读(158)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=235这题中车厢的调动次数正好和排序的交换次数一致,所以只要进行排序并记录就可以了View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 int main() 4 { 5 int n,L,l[100],i,cs,j,temp; 6 scanf("%d",&am 阅读全文
posted @ 2013-02-18 11:15
执着追求的IT小小鸟
阅读(95)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=208需要设置一个静态的变量以保证每次遇到引号都能正确做出判断,这里设置一个flag为正负1,每次遇到引号就变一次符号View Code 1 #include<stdio.h> 2 int main() 3 { 4 int i,flag=1;//标记变量,左引号为-1,右引号为1 5 char str[100000]; 6 while(ge 阅读全文
posted @ 2013-02-18 11:12
执着追求的IT小小鸟
阅读(152)
评论(0)
推荐(0)
摘要:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=49关键在于double所表示的范围是-2^1024~2^1023 float表示范围是-2^128~2^127,用double足以解决问题,还有就是用数学公式表达出根号#include<stdio.h>#include<math.h>int main(){ int n; double p; while(scanf(" 阅读全文
posted @ 2013-02-18 11:06
执着追求的IT小小鸟
阅读(85)
评论(0)
推荐(0)
摘要:
本题从小到大依次算出每个数的所需步骤,然后保留最大的步骤数,这是暴力代码,打表正在学习中……http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=36View Code 1 #include<stdio.h> 2 #include<stdlib.h> 3 int main() 4 { 5 int i,b,a,temp,n,m,j; 6 while(scanf("%d%d& 阅读全文
posted @ 2013-02-18 11:04
执着追求的IT小小鸟
阅读(116)
评论(0)
推荐(0)

浙公网安备 33010602011771号