自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

oBiYuDao的专栏

学程序之路

  • 博客(35)
  • 收藏
  • 关注

原创 10-0. 说反话 (20)

/*给定一句英语,要求你编写程序,将句中所有单词的顺序颠倒输出。输入格式:测试输入包含一个测试用例,在一行内给出总长度不超过80的字符串。字符串由若干单词和若干空格组成,其中单词是由英文字母(大小写有区分)组成的字符串,单词之间用1个空格分开,输入保证句子末尾没有多余的空格。输出格式:每个测试用例的输出占一行,输出倒序后的句子。输入样例:Hello World Here I Come

2014-07-30 22:20:47 617

原创 10-2. 删除字符串中的子串(20)

/*输入2个字符串S1和S2,要求删除字符串S1中出现的所有子串S2,即结果字符串中不能包含S2。 输入格式: 输入在2行中分别给出不超过80个字符长度的、以回车结束的2个非空字符串,对应S1和S2。 输出格式: 在一行中输出删除字符串S1中出现的所有子串S2后的结果字符串。 输入样例:Tomcat is a male ccatatcat输出样例:Tom is a m

2014-07-30 22:08:06 2850

原创 2-09. 装箱问题模拟(20)

假设有N项物品,大小分别为s1, s2, …, si, …, sN,其中si为满足1i输入格式说明: 输入第1行给出物品个数N(i(1 i 输出格式说明: 按照输入顺序输出每个物品的大小及其所在的箱子序号,每个物品占1行,最后一行输出所需的箱子数目。样例输入与输出:序号输入输出1860 70 80 90 30 40 10 20

2014-07-28 22:43:29 1052

原创 2-07. 素因子分解(20)

给定某个正整数N,求其素因子分解结果,即给出其因式分解表达式 N = p1^k1 * p2^k2 *…*pm ^km。输入格式说明: 输入long int范围内的正整数N。输出格式说明: 按给定格式输出N的素因式分解表达式,即 N = p1^k1 * p2^k2 *…*pm ^km,其中pi为素因子并要求由小到大输出,指数ki为pi的个数;当ki==1即因子pi只有一个时不输出ki

2014-07-23 21:18:09 1915

原创 2-06. 数列求和(20)

给定某数字A(1输入格式说明: 输入数字A与非负整数N。输出格式说明: 输出其N项数列之和S的值。样例输入与输出:序号输入输出11 312326 100740740740740740740740740740740740740740740740740740740740740740

2014-07-23 20:06:30 843

原创 2-05. 求集合数据的均方差(15)

设计函数求N个给定整数的均方差。若将N个数A[]的平均值记为Avg,则均方差计算公式为:输入格式说明: 第1行输入正整数N(输出格式说明: 输出这N个数的均方差,要求固定精度输出小数点后5位。样例输入与输出:序号输入输出1106 3 7 1 4 8 2 9 11 53.039742

2014-07-22 20:47:57 1724

原创 8-2. 求矩阵的局部极大值(15)

#include int main(){ int m,n ; scanf("%d%d",&m,&n); int a[m][n]; int i,j,k; k = 0 ; for(i=0; i<m; ++i){ for(j=0; j<n; ++j){ scanf("%d",&a[i][j]);// printf("%d\t",a[i][j]); } }

2014-07-20 17:35:40 1435

原创 8-1. 求一批整数中出现最多的个位数字(20)

#include int bidaxiao(int n);int main(){ int a,b ; scanf("%d",&a); int x[a]; int i,j,k,p; for(i=0; i<a; ++i){ scanf("%d",&x[i]); } // printf("%d %d %d",x[0],x[1],x[2]); int temp_a ;

2014-07-20 11:14:49 1163

原创 8-0. 查找整数(10)

#include int main(){ int n,x; scanf("%d %d",&n,&x); int a[n]; int m,b ; int i,j,k; for(i=0; i<n; ++i){ scanf("%d",&m); a[i] = m ; } for(j=0; j<n; ){// printf("a[%d]=%d ",j,a[j]

2014-07-19 18:33:13 718

原创 7-3. 数素数 (20)

#include #include int sushu(int n) { int i, limit, flag = 1; if(n <= 1) flag = 0; else if(n == 2) flag = 1; else if(n % 2 == 0) flag = 0; else {

2014-07-19 17:33:53 565

原创 7-2. A+B和C (15)

#include void res(double a , double b , double c);int main(){ double a, b, c; int m,i,j,k; scanf("%d",&m); for(j=1; j<=m; ++j){ scanf("%lf%lf%lf",&a,&b,&c); printf("Case #%d: ",j);

2014-07-19 14:35:26 668

原创 7-0. 写出这个数 (20)

#include #include #define STRING_SIZE 1000int main(){ char str[STRING_SIZE] ; gets(str); int len ; len = strlen(str); int i,j,k,m,n; k = 1 ; int sum = 0 ; for(i=0; i<len; ++i){ s

2014-07-17 23:11:02 476

原创 6-3. 单词长度(15)

#include #include #define STRING_SIZE 1000int main() { char str[STRING_SIZE + 1]; char *i ; int len ; gets(str); i = strtok(str, " .") ; while(i != NULL) { len = strlen(i) ; i = strtok(N

2014-07-17 21:49:10 522

原创 6-2. 字符串字母大小写转换(10)

#include #include #define STRING_SIZE 40int main() { int i = 0; char str[STRING_SIZE + 1] ; gets(str); while(str[i] != '#') { if(str[i]>=97 && str[i]<=122) str[i] = str[i] - 32 ; else i

2014-07-17 21:31:24 854

原创 6-1. 简单计算器(20)

#include int main() { char symbol = '0' ; int result, a; int i = 0; scanf("%d", &result); while(symbol != '=') { scanf("%c", &symbol); if(symbol == '=') break; scanf("%d", &a);

2014-07-17 21:13:04 632

原创 6-0. 混合类型数据格式化输入(5)

#include int main(){ double a ; int b ; char c ; double d ; scanf("%lf %d %c %lf",&a,&b,&c,&d); // printf("%lf %d %c %lf",a,b,'c',d); printf("%c %d %.2lf %.2lf",c,b,a,d); return 0;}

2014-07-17 20:58:55 642 1

原创 5-3. 求a的连续和(15)

#include int main(){ int a , n ; scanf("%d %d",&a ,&n); int i,j,k ; j = 1 ; int temp_sum = 0 ; int temp_a = 0 ; // for(i=1; i<n; ++i){// j *= 10 ;// }// printf("%d\n", j); while(

2014-07-16 21:37:11 384

原创 5-1. 约分最简分式(15)

#include #include int main(){ int a; scanf("%d",&a); // char shuzi_0 = 'ling' ;// char shuzi_1 = 'yi' ;// char shuzi_2 = 'er' ;// char shuzi_3 = 'san' ;// char shuzi_4 = 'si' ;// char shu

2014-07-16 21:22:55 866

原创 5-1. 约分最简分式(15)

#include int gcd(int m , int n){ int i; while(1){ i = m % n ; if(i == 0){ break; } m = n ; n = i ; } return n;}int main(){ int a,b; scanf("%d/%d",&a,&b); int j;

2014-07-15 23:50:17 1128

原创 5-0. 求序列前N项和(15)

#include int main(){ int n; scanf("%d",&n); double x = 1.0 ; double y = 2.0 ; int i = 1 ; double temp_sum = 0 ; while(i <= n){ temp_sum += y/x ; double temp_x1 = y ; double

2014-07-15 00:04:27 779

原创 4-4. 猜数字游戏(15)

#include int main() { int number, n; int count = 0; int value; scanf("%d%d", &number, &n); while(count <= n) { scanf("%d", &value); if(value < 0) { printf("Game Over\n"); break; }

2014-07-14 22:51:46 878

原创 4-3. 统计素数并求和(20)

#includeint sushu(int x){ int i; int temp_x = 0; if(x == 1){ return 0; } for(i=1;i<=x;i++){ if(x%i == 0){ ++temp_x; } } if(temp_x == 2){ return

2014-07-14 22:47:26 770

原创 4-2. 打印九九口诀表(15)

#include int main(){ int n; scanf("%d",&n); int m = 1; do{ //printf("%d\n",m); int temp_m = 1; do{ int temp_n = m * temp_m; printf("%d*%d=%-4d",temp_m,m,temp_n); ++temp_m;

2014-07-14 22:44:11 654

原创 4-1. 水仙花数(20)

#include int main(){ int a; scanf("%d",&a); const int n = 10 ; int i,j,k,temp_a,temp_sum; int u_limit,l_limit; l_limit = 1 ; for(i=1; i<a; ++i){ l_limit = n * l_limit ; } u_limit = l

2014-07-14 22:40:56 733 1

原创 4-0. 求符合给定条件的整数集(15)

#include int main(){ int a; scanf("%d",&a); int i,j,k,count; for(i = a; i<a+4; ++i){ count = 0; for(j = a; j<a+4; ++j){ for(k = a; k<a+4; ++k){ if(i!=j && i!=k && j!=k){

2014-07-14 21:53:42 390

原创 3-4. 成绩转换(15)

#include int main(){ int a; scanf("%d",&a); const int A = 90; const int B = 80; const int C = 70; const int D = 60; if(a < A){ if(a < B){ if(a < C){ if(a < D){ printf("E\n"

2014-07-14 21:36:58 496

原创 3-3. 12-24小时制(15)

#include int main(){ int a,b; scanf("%d:%d",&a,&b); const int h_to_m = 60 ; const int d_to_h = 24 ; int temp_time = a * h_to_m + b ; if( temp_time == 0 || temp_time == (h_to_m * d_to_h)

2014-07-14 21:25:11 648

原创 3-2. 用天平找小球(10)

#include int main(){ int a,b,c; scanf("%d %d %d",&a,&b,&c); if(a != b){ if(a != c){ printf("A\n"); } else{ printf("B\n"); } } else{ printf("C\n"); } return 0;}

2014-07-14 20:57:45 461

原创 3-1. 三天打鱼两天晒网(15)

#include int main(){ int a; scanf("%d",&a); const int n = 5 ; if(a%n == 0 || a%n > 3){ printf("Drying in day %d",a); } else{ printf("Fishing in day %d",a); } return 0;}

2014-07-14 20:54:26 447

原创 3-0. 超速判断(10)

#include int main(){ int speed ; scanf("%d",&speed); const int speed_s = 60 ; if(speed > speed_s){ printf("Speed: %d - Speeding",speed); } else{ printf("Speed: %d - OK",speed); }

2014-07-14 20:47:33 474

原创 2-4. BCD解密(10)

#include >int main(){ int a ; scanf("%d",&a); //定义并输入值 const int i = 16 ; const int j = 10 ; //定义进制常量 int temp_a1 = a / i ; int temp_a2 = a % i ; //在默认进制下取

2014-07-14 20:40:13 659

原创 2-3. 逆序的三位数(10)

#include int main(){ int a; scanf("%d",&a); //定义输入的变量 const int a_to_h = 100; const int a_to_t = 10; //定义换算常量 int temp_h_a = a / a_to_h ; int temp_t_a = (a - tem

2014-07-14 00:05:32 911 3

原创 2-2. 然后是几点(15)

#include int main(){ int a,b; scanf("%d %d",&a,&b); //定义输入的变量 const int m_to_h = 60; const int a_to_h = 100; //定义换算常量 int temp_time = a / a_to_h * m_to_h + a % a_to_h +

2014-07-13 23:59:04 1484

原创 2-1. 厘米换算英尺英寸(15)

#include int main(){ int cm_a; scanf("%d",&cm_a); //定义输入的变量 const int cm_to_m = 100; const float m_to_inch = 0.3048; const int inch_to_foot = 12; //定义换算常量 int temp_

2014-07-13 23:40:51 922

原创 2-0. 整数四则运算(10)

#include int main(){int A,B;scanf("%d %d",&A,&B);  //初始化A和B,并从键盘输入。 int Plus_AB , Minus_AB , Multiply_AB , Divide_AB;Plus_AB = A + B ;Minus_AB = A - B;Multiply_AB = A * B;

2014-07-13 23:22:47 174

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除