随笔分类 -  手敲代码

摘要:1 #include <stdio.h> 2 #include <stdlib.h> 3 int visit(int, int); 4 5 int maze[7][7] = 6 7 { 8 {2, 2, 2, 2, 2, 2, 2}, 9 {2, 0, 0, 0, 0, 0, 2}, 10 {2, 阅读全文
posted @ 2020-09-26 15:10 然终酒肆 阅读(325) 评论(0) 推荐(0)
摘要:1 #include "stdio.h" 2 #include "String.h" 3 #define MAX 10000 4 int f[MAX]; 5 void Arr_reset(int a[],int m,int n) 6 { 7 int i; 8 for(i=m;i<=m;i++) 9 阅读全文
posted @ 2020-09-26 14:53 然终酒肆 阅读(427) 评论(0) 推荐(0)
摘要:1.问题描述 1221是一个非常特殊的数,它从左边读和从右边读是一样的,编程求所有这样的四位十进制数。 输出格式 按从小到大的顺序输出满足条件的四位十进制数。 血马简单 但是还是要敲 1 #include"stdio.h" 2 int main(void) 3 { 4 int i,a,b,c,d; 阅读全文
posted @ 2020-09-26 14:26 然终酒肆 阅读(203) 评论(0) 推荐(0)
摘要:1 #include <stdio.h> 2 #define N 12 //会输出 13 行 更改会输出相应的 N+1 行 3 long combi(int n, int r) 4 { 5 int i; 6 long p = 1; 7 for(i = 1; i <= r; i++) 8 p = p 阅读全文
posted @ 2020-09-24 17:49 然终酒肆 阅读(225) 评论(0) 推荐(0)
摘要:1 #include "stdio.h" 2 #include "math.h" 3 int main(void) 4 { 5 double y; 6 int x,m; 7 for(y=10;y>=-10;y--) 8 { 9 m=2.5*sqrt(100-y*y); 10 for(x=1;x<30 阅读全文
posted @ 2020-09-24 13:35 然终酒肆 阅读(260) 评论(0) 推荐(0)
摘要:输入: 请输入数时用空格隔开输入你要判断是否是回文的个数: 1 5 9 9 5 1 输出: 您输入的是回文 1 #include"stdio.h" 2 #define N 6 //通过更改 N 的值,可以改变输入的数的个数 3 //本题思想用数组的第一位与最后一位相比,然后依次第二与倒数第二。。。。 阅读全文
posted @ 2020-09-23 23:21 然终酒肆 阅读(367) 评论(0) 推荐(0)
摘要:1 #include"stdio.h" 2 #include"stdlib.h" 3 int main(void) 4 { 5 int n,a1,count=0,j;//count 用于角标的计数,j 控制 for 循环 6 int a[100]; 7 printf("Enter n:"); 8 s 阅读全文
posted @ 2020-09-23 23:12 然终酒肆 阅读(550) 评论(0) 推荐(0)
摘要:#include "stdio.h" #define N 50 long fun(char *s) { int i,t; long sum=0; for(i=0;s[i];i++) { if(s[i]>='0'&&s[i]<='9')//当字符是'0'--'9'时,*-‘0'就行了 t=s[i]-' 阅读全文
posted @ 2020-09-20 21:45 然终酒肆 阅读(388) 评论(0) 推荐(0)
摘要:1949年的国庆节(10月1日)是星期六。今年(2012)的国庆节是星期一。 那么,从建国到现在,有几次国庆节正好是星期日呢? 1 # include <stdio.h> 2 int yday(int year); 3 int main(void) 4 { 5 int year; 6 int n; 阅读全文
posted @ 2020-09-20 21:10 然终酒肆 阅读(167) 评论(0) 推荐(0)
摘要:#include<stdio.h> #include<stdlib.h> #define MAXINE 100 int main(void) { int j,i; int n; int a[MAXINE][MAXINE]; printf("Enter n:"); scanf("%d",&n); a[ 阅读全文
posted @ 2020-09-20 15:58 然终酒肆 阅读(115) 评论(0) 推荐(0)
摘要:ABCDEFG BABCDEF CBABCDE DCBABCD EDCBABC 这是一个5行7列的图形,请找出这个图形的规律,并输出一个n行m列的图形。 #include<stdio.h> #include<stdlib.h> #define MAXINE 26 void print(char a[ 阅读全文
posted @ 2020-09-20 15:47 然终酒肆 阅读(177) 评论(0) 推荐(0)
摘要:对于长度为5位的一个01 串,每一位都可能是0或1,一共有32种可能。它们的前几个是: 00000 00001 00010 00011 00100 请按从小到大的顺序输出这 32种01串。 1 #include<stdio.h> 2 int main(void) 3 { 4 int count=0; 阅读全文
posted @ 2020-09-20 14:40 然终酒肆 阅读(288) 评论(0) 推荐(0)
摘要:问题描述 给定圆的半径r,求圆的面积。 输入格式 输入包含一个整数r,表示圆的半径。 输出格式输出一行,包含一个实数,四舍五入保留小数点后7位,表示圆的面积。 样例输入 4 样例输出 50.2654825 1 #include<stdio.h> 2 #define PI 3.141592653589 阅读全文
posted @ 2020-09-20 14:31 然终酒肆 阅读(186) 评论(0) 推荐(0)
摘要:是很简单 我也得敲啊 啤酒每罐2.3元,饮料每罐1.9元。小明买了若干啤酒和饮料,一共花了 82.3元。 我们还知道他买的啤酒比饮料的数量少,请你计算他买了几罐啤酒。 注意:答案是一个整数 1 int main(int argc, char** argv) { 2 for(int i=1;i*2.3 阅读全文
posted @ 2020-09-20 14:22 然终酒肆 阅读(208) 评论(0) 推荐(0)
摘要:1 #include <iostream> 2 #include<stdio.h> 3 /* run this program using the console pauser or add your own getch, system("pause") or input loop */ 4 int 阅读全文
posted @ 2020-09-19 20:59 然终酒肆 阅读(81) 评论(0) 推荐(0)
摘要:要手动敲这些代码 为了再更加清晰理解算法本质 我尽量用最基本的c语言去敲 而不取用现成的库函数 阅读全文
posted @ 2020-09-19 20:52 然终酒肆 阅读(94) 评论(0) 推荐(0)