摘要: 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小小鸟 阅读(146) 评论(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小小鸟 阅读(64) 评论(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小小鸟 阅读(125) 评论(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小小鸟 阅读(175) 评论(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小小鸟 阅读(67) 评论(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小小鸟 阅读(89) 评论(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小小鸟 阅读(99) 评论(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小小鸟 阅读(103) 评论(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小小鸟 阅读(96) 评论(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小小鸟 阅读(145) 评论(0) 推荐(0) 编辑