- 博客(31)
- 收藏
- 关注
转载 资源网站
http://blog.sina.cn/dpool/blog/s/blog_8f3a82ee0101heo3.html转载于:https://www.cnblogs.com/zoti007/articles/10461028.html
2019-03-02 14:36:00
126
转载 33 Print Graphics Problerm (II)
#include <stdio.h>main(){ int n,i,j; while(scanf("%d",&n)!=EOF) { if(n%2==0) { for(i=1;i<=n;i++) { ...
2018-12-15 23:05:00
442
转载 32 编写函数:两点之间的距离
知识点扩充:typedef的用法2) 为自定义数据类型(结构体、共用体和枚举类型)定义简洁的类型名称在这里,结构体 struct Point 为新的数据类型,在定义变量的时候均要向上面的调用方法一样有保留字 struct,而不能像 int 和 double 那样直接使用 Point 来定义变量。#include <...
2018-12-07 16:57:00
312
转载 31 编写函数:复数的运算
知识点补充: 1,struct 数据结构体,成员是全局 struct CPLX //数据结构体,成员是全局 ;按格式输入一个复数,存入cx所指的内存中。{ int a; int b;}; ...
2018-12-07 15:56:00
513
转载 30 成绩的柱状图
#include <stdio.h>main(){ int i,x,n,j; char s[9]; scanf("%d",&n); for(i=1;i<=n;i++) { scanf("%s%d",s,&x); printf("%8s |",s...
2018-11-22 17:45:00
383
转载 29 数组去重
#include<stdio.h>int main(){ int m,n,i,a; scanf("%d",&m); while(m--) { int b[1001],s,j=0; scanf("%d",&n); for(i=0;i<n...
2018-11-22 17:26:00
77
转载 28 字符串的逆序
1,数组可以输出a[i]的格式;2,trlen(ch); 函数strlen求字符串的长度,数组还可以被计算长度;但仅限于字符;#include <stdio.h>#include <string.h>int main(){ char ch[100]; int m,i; scanf...
2018-11-20 22:03:00
87
转载 27 登录密码验证
知识点补充:string 头文件下的strcmp函数,用来对比两个字符串,如果相等返回0,第一个字符 串 大于第二个字符串时返回一个正值,否则返回负值.#include<stdio.h>#include<string.h>int main(){ int i=0; c...
2018-11-20 21:32:00
177
转载 26 成绩统计
知道怎么算出每个阶段的人数,在输出上出现问题,只能暴力输出;#include <stdio.h>main(){ int a[1111]={0}; int n,E=0,G=0,A=0,P=0,F=0; int k,i=0,j; while(scanf("%d",&n)!=EOF) { ...
2018-11-18 11:46:00
104
转载 25 分数统计
原本思路:暴力搜索,暴力存储每一个数字,但是数字出现的次数无法算;知识扩充:a[k]++<=>a[k]=a[k]+1,并非k+1; a[120]={0}表示数组内的元素值都是0;此题思路:1,并不把数字的值存在数组内,而是作为数组的下标,如输入k,------>a[k] 2...
2018-11-18 11:07:00
124
转载 24 寻求勾股数
思路基本对,问题出在输出的分号,最后一次输出是不输出分号的;解决思路:设置0 1,每次重新循环时候就归0,达到要求+1;两者互不影响,后者可以放在最后的循环里解题思路:暴力解题,三个for循环,在最里面一层输出和判定; 缺点:不够优化,做了很多无用的计算for(直角边i = 下限;i <= 上线;i++) {...
2018-11-16 09:40:00
891
转载 23 时间:24小时制转12小时制
#include <stdio.h> //错误,答案;范围错了,比如输入12:00只会得到12:00am但是需要的是pmmain(){ int shi,fen; scanf("%d:%d",&shi,&fen); if(shi>12) printf("%02d:%02d p.m."...
2018-11-15 23:49:00
512
转载 22 编写函数:是否水仙花数?
#include <stdio.h> //错误代码,区别在return 0;和exit(0);#include <stdlib.h>int is_daffodil(int n){ int a,b,c; int sum; if(n>=100&&n<=999)...
2018-11-15 23:29:00
1260
转载 21 百钱买百鸡问题
首先题目解释:这是给出商品单价,商品总数,还有你钱包的钱(必须全部花完哦); 然后让你设计出解决方案,方案会面临不止一个,也会没方案,这是算法;此题是可以用两层循环嵌套来求出,但是由于不知总量,不是别的100定值,所以会溢出;只能另寻他路;编程知识一般,数学能力主要;...
2018-11-10 23:54:00
99
转载 1 函数调用
c=sum(a,b);无论在输出函数里还是普通赋值,都别忘记了函数变量,a,b;转载于:https://www.cnblogs.com/zoti007/p/9932794.html
2018-11-08 23:48:00
97
转载 20 编写函数:计算分段函数
Description设有函数y=f(x)定义为:给定x的值,编程求出y的值并输出。-----------------------------------------------------------------------------编写函数func()和output(),其原型为:double func(double x);功能:计算f(x)并返回。...
2018-11-08 19:49:00
4985
转载 19 简单的数值统计
关于while()的EOF的用法上;#include<stdio.h> //错误代码,能运行,不能起作用,不能输出;#include<stdlib.h>main(){ int a; double p1,p2; int z=0,f=0,sum1=0,sum2=0; while(scanf("...
2018-11-07 23:35:00
374
转载 18 输出月历
问题点:1,输出格式问题,没法对齐;突破点:输出格式控制,左对齐或右对齐;#include <stdio.h>main(){ int n,i; scanf("%d",&n); printf("Sun Mon Tue Wen Thu Fri Sat\n"); if (n==7) n=0; ...
2018-11-03 20:41:00
134
转载 17 只有一个二元运算符的表达式运算
#include <stdio.h> //我做的#include <stdlib.h>main(){ int a,b; char c; while(scanf("%d%c%d",&a,&c,&b)!=EOF) { if(a==0&&am...
2018-10-25 19:40:00
538
转载 16 Print Graphics Problerm (I)
错误思想:1,想着分成三部分,左边空格,中间+,右边空格; 2,在输出空格上和输出+产生矛盾,突破:看成两部分;技能:只需要管输出空格剩下的就是+了,那么只需要决定输出多少空格和多少+就行了 没必要右边也输出空格; #include <stdio.h>main()...
2018-10-25 16:53:00
365
转载 15 1!+2!+…+k!=?
#include <stdio.h> //暂定main (){ unsigned long long sum,Sum=0; int k,i, j; scanf("%d",&k); for(i=1;i<=k;i++) { sum=1; for(j=1;...
2018-10-24 21:23:00
184
转载 14 求100以内的素数
#include <stdio.h>int main(){ int m,n,i,j,k; scanf("%d %d",&m,&n); printf("=====\n"); for(i=n;i>=m;i--) { k=0; for(j=1;j<i;j++) ...
2018-10-24 21:07:00
145
转载 13 Sum Problem (III) : Input/Output Practice
#include <stdio.h>#include <stdlib.h> //报错原因,没有这一行,但是调用了exit(0)函数;main(){ int N,a; int sum,i; while(scanf("%d",&N)!=EOF) { sum = 0; ...
2018-10-24 20:37:00
514
转载 12 输出整数的最低两位
题目意思是把最右边的两位数输出来,而不是最小的两个数字 组合;另外,想要提取最后几位数字就用%a,n=10^a#include<stdio.h>int main(){ int a; scanf("%d",&a); a=(a<0?-a:a); if(a<10 && ...
2018-10-23 17:53:00
404
转载 11 它满足条件吗?
问题出现在判断平方数那里,不确定是否开根号为整数。#include <stdio.h>#include <math.h>main(){ int a,b; scanf("%d",&a); b=sqrt(a); if (a==b*b&&a%2==0) printf("yes...
2018-10-23 17:38:00
111
转载 Sum Problem
#include <stdio.h>main(){ int n,a,sum; int i; while(scanf("%d",&n)!=EOF) { sum = 0; //此行为何在这里命sum=0?而不是在int后。 for(i=1;i<=n;i+...
2018-10-23 15:14:00
67
转载 9 GHacker的解谜过关游戏
问题 H: GHacker的解谜过关游戏时间限制:1 Sec内存限制:2 MB提交:7294解决:4477[提交][状态][讨论版]题目描述GHacker最近痴迷于一个新上市的解谜游戏,其中一关的过关是破解一个字符串S。经过3天的冥思苦想,GHacker成功的搞明白了这其中的奥秘,把串S中的整数取出来求和,就可以过关了。但是GHacker的数学实在糟糕...
2018-10-17 21:40:00
630
转载 2 哪一行比较长
1 #include <stdio.h> //错 2 main() 3 { 4 char s[100]; 5 char str[100]; 6 int i; 7 int a,b; 8 scanf("%s",&s); 9 scanf("%s",&...
2018-10-17 21:11:00
224
转载 1 求1+2+...+n=?
1, 1 #include <stdio.h> //错; 2 main() 3 { 4 unsigned long long int n,sum; 5 scanf("%llu",&n); 6 sum=(1+n)*n/2; 7 printf("%llu",sum); 8 ...
2018-10-17 20:50:00
112
转载 8 求字符的值
1 #include <stdio.h>2 void main()3 {4 char ch1,ch2,ch3;5 scanf("%c%c%c",&ch1,&ch2,&ch3);6 printf("%.3d %.3o %.3x\n",ch1,ch1,ch1);7 printf("...
2018-10-17 20:19:00
161
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人