04 2019 档案

摘要:程序: 1 #include<stdio.h> 2 #include<string.h> 3 #define N 81 4 5 int main() { 6 char ch[N],temp[N]; 7 int i,cnt,lng=0; 8 scanf("%d",&cnt); 9 gets(ch); 阅读全文
posted @ 2019-04-30 16:59 cxc1357 阅读(1197) 评论(0) 推荐(0)
摘要:程序: 1 #include<stdio.h> 2 #include<string.h> 3 #define N 85 4 5 int main() { 6 int t,i,j,m=0,flag; 7 char original[N],target[N]; 8 gets(original); 9 f 阅读全文
posted @ 2019-04-30 16:38 cxc1357 阅读(1734) 评论(0) 推荐(0)
摘要:PTA 1 #include<stdio.h> 2 int main() { 3 int year,month,day,cnt,flag; 4 flag = 0; 5 scanf("%4d/%2d/%2d",&year,&month,&day); 6 if((year%4 ==0 && year%1 阅读全文
posted @ 2019-04-28 23:33 cxc1357 阅读(303) 评论(0) 推荐(0)
摘要:一、人的行动的基本原理 基本概念: 什么是人的行动?人的有意图行为(purposeful behabior) 人的行动有何特点?只有个体,即“行动人”才能实施行动,群体、国家、社会不会独立存在,即没有“群体的”、“国家的”、“集体的”行动这回事 人何时会发起行动(人的行动之前提)?需满足两个要素:行 阅读全文
posted @ 2019-04-28 23:26 cxc1357 阅读(800) 评论(0) 推荐(0)
摘要:一、基本概念 什么是线性结构和非线性结构,举例?线性结构是一个有序数据元素的集合,元素之间一对一关系,即除了第一个和最后一个元素外,其他元素首尾相接,如线性表、栈、队列、数组;非线性结构每个元素可能与零或多个其他元素发生关系,如二维数组、树、图等 数据存储结构分类?顺序(随机存取)、链式(顺序存取) 阅读全文
posted @ 2019-04-27 12:14 cxc1357 阅读(194) 评论(0) 推荐(0)
摘要:1、交换排序 a、冒泡排序 1 #include <stdio.h> 2 int main() { 3 int a[] = {4, 0 , 2, 3, 1}, i, j, t; 4 for(i=4; i>=0; i--) { 5 for(j=0; j<i; j++) { 6 if(a[j]>a[j+ 阅读全文
posted @ 2019-04-27 09:17 cxc1357 阅读(218) 评论(0) 推荐(0)
摘要:题目: 7-59 字符串逆序 (15 分) 输入一个字符串,对该字符串进行逆序,输出逆序后的字符串。 输入格式: 输入在一行中给出一个不超过80个字符长度的、以回车结束的非空字符串。 输出格式: 在一行中输出逆序后的字符串。 输入样例: Hello World! 输出样例: !dlroW olleH 阅读全文
posted @ 2019-04-26 23:04 cxc1357 阅读(2114) 评论(0) 推荐(0)
摘要:要求: 本题要求统计一个整型序列中出现次数最多的整数及其出现次数。 输入格式: 输入在一行中给出序列中整数个数N(0<N≤1000),以及N个整数。数字间以空格分隔。 输出格式: 在一行中输出出现次数最多的整数及其出现次数,数字间以空格分隔。题目保证这样的数字是唯一的。 输入样例: 10 3 2 - 阅读全文
posted @ 2019-04-26 22:48 cxc1357 阅读(2073) 评论(0) 推荐(0)
摘要:要求: 一个矩阵元素的“鞍点”是指该位置上的元素值在该行上最大、在该列上最小。 本题要求编写程序,求一个给定的n阶方阵的鞍点。 输入格式: 输入第一行给出一个正整数n(1)。随后n行,每行给出n个整数,其间以空格分隔。 输出格式: 输出在一行中按照“行下标 列下标”(下标从0开始)的格式输出鞍点的位 阅读全文
posted @ 2019-04-26 21:39 cxc1357 阅读(1280) 评论(0) 推荐(0)
摘要:要求: 一个数组A中存有N(>0)个整数,在不允许使用另外数组的前提下,将每个整数循环向右移M(≥0)个位置,即将A中的数据由(A​0​​A​1​​⋯A​N−1​​)变换为(A​N−M​​⋯A​N−1​​A​0​​A​1​​⋯A​N−M−1​​)(最后M个数循环移至最前面的M个位置)。如果需要考虑程 阅读全文
posted @ 2019-04-26 00:02 cxc1357 阅读(243) 评论(0) 推荐(0)
摘要:PTA 7-51 求n以内最大的k个素数以及它们的和 1 #include<stdio.h> 2 #include<math.h> 3 4 int isPrime(int n); 5 int main() { 6 int i,cnt=0,n,k,sum; 7 scanf("%d%d",&n,&k); 阅读全文
posted @ 2019-04-25 22:14 cxc1357 阅读(1025) 评论(1) 推荐(0)
摘要:PTA 7-50 近似求PI 网友代码: 1 include <stdio.h> 2 3 int main(){ 4 double eps, sum=1, i, temp=1; 5 scanf("%le", &eps); 6 for(i=1; temp>eps; i++){ 7 temp = tem 阅读全文
posted @ 2019-04-24 22:18 cxc1357 阅读(769) 评论(0) 推荐(0)
摘要:PTA 乘2后不变 1 #include<stdio.h> 2 #include<string.h> 3 #define N 21 4 5 int main(){ 6 char original[N]; 7 int doubledNum[N],i,digitsCount[10]; 8 int car 阅读全文
posted @ 2019-04-24 21:17 cxc1357 阅读(213) 评论(0) 推荐(0)
摘要:动态数组的实现 1 #include<stdio.h> 2 #include<stdlib.h> 3 4 int main(){ 5 int i,n,*a; 6 scanf("%d",&n); 7 a=(int*)calloc(n,sizeof(int)); 8 for(i=0;i<n;i++){ 阅读全文
posted @ 2019-04-24 20:25 cxc1357 阅读(310) 评论(0) 推荐(0)
摘要:《c语言程序设计》(第三版)何钦铭 P190 C语言中实参和形参之间的数据传递为“值传递”,调用函数不能改变实参变量的值 将指针作为函数形参,变量地址作为实参,改变实参指针变量所指向变量的值 同理,若想通过函数改变指针变量的值,则将指针的指针作为函数形参,指针的地址作为实参 1 #include<s 阅读全文
posted @ 2019-04-23 23:11 cxc1357 阅读(248) 评论(0) 推荐(0)
摘要:程序: 1 #include<stdio.h> 2 double fact(int n); 3 4 int main() { 5 int m,n; 6 int c; 7 scanf("%d%d",&m,&n); 8 c=(int)(fact(n)/(fact(m)*fact(n-m))); 9 pr 阅读全文
posted @ 2019-04-23 19:36 cxc1357 阅读(866) 评论(0) 推荐(0)
摘要:PTA 1 #include <stdio.h> 2 int main(){ 3 //无符号整型才能表达32位二进制数对应的十进制数 4 unsigned int decimalNum; 5 unsigned int digitsCount=0; 6 scanf("%u", &decimalNum) 阅读全文
posted @ 2019-04-23 19:18 cxc1357 阅读(199) 评论(0) 推荐(0)
摘要:PTA 7-46 爬动的蠕虫 1 #include<stdio.h> 2 int main() { 3 int N,U,D,R,T=0; 4 scanf("%d%d%d",&N,&U,&D); 5 R = N-U; 6 if(R<=0) T=1; 7 else { 8 T = R/(U-D)*2+1 阅读全文
posted @ 2019-04-23 18:56 cxc1357 阅读(248) 评论(0) 推荐(0)
摘要:PTA 7-45 找完数 网友“云上明月”的程序: 1 #include<stdio.h> 2 int isPerfect(int num); 3 4 int main() { 5 int i,j,m,n,exist=0; 6 int maxFactor; 7 scanf("%d%d",&m,&n) 阅读全文
posted @ 2019-04-23 10:52 cxc1357 阅读(761) 评论(0) 推荐(0)
摘要:我的程序,一个用例通不过 1 #include<stdio.h> 2 void sort(int *a,int n); 3 4 int main() { 5 int num,a,b,c,count=1; 6 scanf("%d",&num); 7 while(num!=495&&num!=0) { 阅读全文
posted @ 2019-04-23 09:46 cxc1357 阅读(471) 评论(0) 推荐(0)
摘要:思路: 1、输入:数组长度n,待查找的有序数组a[],要找的元素key 2、输出:待查找元素在数组中的位置,若不存在返回-1 3、实现:三个指针,left、mid、right 1 #include<stdio.h> 2 int binarySearch(int a[],int key,int n); 阅读全文
posted @ 2019-04-22 22:42 cxc1357 阅读(192) 评论(0) 推荐(0)
摘要:程序: 1 #include<stdio.h> 2 int main() { 3 int i,n,*result; 4 scanf("%d",&n); 5 int shuffle[54],card1[54],card2[54]; 6 result = n%2==0?card1:card2; 7 fo 阅读全文
posted @ 2019-04-22 15:59 cxc1357 阅读(252) 评论(0) 推荐(0)
摘要:模拟除法 1 #include <stdio.h> 2 int main() 3 { 4 char a[1000];//创建存表 5 int len=0,count=0; 6 int n; 7 int t=1; 8 scanf("%d",&n); 9 while(1) 10 { 11 count++ 阅读全文
posted @ 2019-04-18 16:24 cxc1357 阅读(243) 评论(0) 推荐(0)
摘要:程序: 1 #include<stdio.h> 2 #include<math.h> 3 int main() { 4 int i=0,N; 5 scanf("%d",&N); 6 int H[N],W[N]; 7 double P; 8 for(i=0; i<N; i++) { 9 scanf(" 阅读全文
posted @ 2019-04-18 14:26 cxc1357 阅读(1457) 评论(0) 推荐(0)
摘要:程序: 1 #include <stdio.h> 2 3 int main () { 4 5 int rabbit=0,turtle=0,minute,rest=-1,run=10; //rest为0或负时,兔子休息,run为1-10是兔子跑 6 scanf ("%d",&minute) ; 7 8 阅读全文
posted @ 2019-04-18 13:44 cxc1357 阅读(634) 评论(0) 推荐(0)
摘要:程序: 1 #include<stdio.h> 2 3 int main() { 4 int n,f,y; 5 int flag = 0; 6 scanf("%d",&n); 7 for(y=0; flag==0 && y<=50; y++) { 8 for(f=0; f<=100; f++) { 阅读全文
posted @ 2019-04-18 10:33 cxc1357 阅读(353) 评论(0) 推荐(0)
摘要:把316分解为两个数之和,这两个数分别能被11和13整除 1 #include <stdio.h> 2 int main() { 3 int i=0,j,k; 4 do { 5 i++; 6 k=316-13*i; 7 } while(k%11); 8 j=k/11; 9 printf("316=1 阅读全文
posted @ 2019-04-17 16:48 cxc1357 阅读(173) 评论(0) 推荐(0)
摘要:程序: #include<stdio.h> int main() { int a,b,hour,min; scanf("%d%d",&a,&b); hour = a / 100; //输入的小时数 min = a % 100; //输入的分钟数 min = 60 * hour + min + b; 阅读全文
posted @ 2019-04-17 13:48 cxc1357 阅读(379) 评论(0) 推荐(0)
摘要:程序: #include<stdio.h> int main() { double s,w; int t; scanf("%lf %d",&s,&t); if(s <= 3) w = 10; else if(s > 3 && s <= 10) w = 10 + (s-3) * 2; else w = 阅读全文
posted @ 2019-04-17 13:47 cxc1357 阅读(328) 评论(0) 推荐(0)
摘要:程序: #include<stdio.h> int main() { int a,b; char c; scanf("%d",&a); while(scanf("%c",&c)) { switch(c) { case('+'):scanf("%d",&b);a+=b;break; case('-') 阅读全文
posted @ 2019-04-17 13:44 cxc1357 阅读(884) 评论(0) 推荐(0)
摘要:程序: #include<stdio.h> int main() { int a,b,c; scanf("%d%d%d",&a,&b,&c); if(a-b == 0) printf("%c",'C'); else if(a-c == 0) printf("%c",'B'); else printf 阅读全文
posted @ 2019-04-17 13:43 cxc1357 阅读(199) 评论(0) 推荐(0)
摘要:程序: 1 #include <stdio.h> 2 int main() 3 { 4 int num, times; 5 scanf("%d %d", &num,&times); 6 7 int i = 0, guess; 8 while(i< times){ 9 scanf("%d", &gue 阅读全文
posted @ 2019-04-17 13:42 cxc1357 阅读(1773) 评论(0) 推荐(0)
摘要:我的程序: #include<stdio.h> #include<math.h> int main(){ int n,a,b,s=0,t; scanf("%d",&n); a = (int)log10(n) + 1; b = a; while(b>1){ b--; t = pow(10,b); s 阅读全文
posted @ 2019-04-17 13:40 cxc1357 阅读(653) 评论(0) 推荐(0)
摘要:程序: 1 #include<stdio.h> 2 #include<stdlib.h> 3 #define N 50 4 5 int main() { 6 char pinyin[][5] = {"ling","yi","er","san","si","wu","liu","qi","ba","j 阅读全文
posted @ 2019-04-17 13:39 cxc1357 阅读(1055) 评论(0) 推荐(0)
摘要:程序: 方法1: 1 #include <stdio.h> 2 #define N 10000 3 int main(){ 4 long n, temp; 5 long mask=1; 6 scanf("%ld", &n); 7 temp = n; 8 while(temp/10 != 0){ 9 阅读全文
posted @ 2019-04-16 22:47 cxc1357 阅读(1339) 评论(0) 推荐(0)
摘要:程序: 1 #include<stdio.h> 2 3 int main() { 4 int i,n,s = 1; 5 scanf("%d",&n); 6 for(i=1; i<n; i++) { 7 s = (s+1)*2; 8 } 9 printf("%d",s); 10 } 阅读全文
posted @ 2019-04-16 22:00 cxc1357 阅读(721) 评论(0) 推荐(0)
摘要:程序: 1 #include<stdio.h> 2 3 int main() { 4 int i,n; 5 double fz = 1,fm = 0,sum = 2; 6 scanf("%d",&n); 7 double s = 0; 8 for(i = 1; i <= n; i++) { 9 fm 阅读全文
posted @ 2019-04-16 21:48 cxc1357 阅读(646) 评论(0) 推荐(0)
摘要:程序: 1 #include<stdio.h> 2 #include<math.h> 3 int prime(int p); 4 5 int main() { 6 int m,n,i; 7 int sum = 0; 8 int count = 0; 9 scanf("%d %d",&m,&n); 1 阅读全文
posted @ 2019-04-16 20:56 cxc1357 阅读(1083) 评论(0) 推荐(0)
摘要:程序: 1 #include<stdio.h> 2 3 int main(){ 4 int num1,num2,temp1,temp2,r; 5 scanf("%d %d",&num1,&num2); 6 temp1 = num1; 7 temp2 = num2; 8 while(temp2 != 阅读全文
posted @ 2019-04-05 16:28 cxc1357 阅读(1392) 评论(0) 推荐(0)
摘要:程序: #include<stdio.h> int main(){ int a; int b,c; scanf("%d",&a); b = (int)((double)a/100/0.3048); c = (int)(((double)a/100/0.3048-b)*12); printf("%d 阅读全文
posted @ 2019-04-01 23:51 cxc1357 阅读(266) 评论(0) 推荐(0)