Problem H: 零起点学算法87——打印所有低于平均分的分数
#include<stdio.h>
int main(){
int n,a[],b[];
while(scanf("%d",&n)!=EOF){
int s=;
for(int i=;i<n;i++){
scanf("%d",&a[i]);
s+=a[i];
}
float ave=(float)s/n;
int j=;
for(int i=;i<n;i++){
if(a[i]<ave){
b[j]=a[i];
j++;
}
}
if(j==)
printf("\n");
else{
for(int i=;i<j-;i++){
printf("%d ",b[i]);
}
printf("%d\n",b[j-]);
}
}
return ;
}
Problem H: 零起点学算法87——打印所有低于平均分的分数的更多相关文章
- Problem H: 零起点学算法109——单数变复数
#include <stdio.h> #include<string.h> int main(void) { int n; ]; scanf("%d",&a ...
- Problem H: 零起点学算法103——查找最大元素
#include<stdio.h> #include<string.h> int main() { ]; while(gets(a)!=NULL) { ]; ;a[i]!='\ ...
- Problem H: 零起点学算法28——参加程序设计竞赛
#include<stdio.h> int main() { int a,b; while(scanf("%d %d",&a,&b)!=EOF) ||b ...
- Problem G: 零起点学算法106——首字母变大写
#include<stdio.h> #include<string.h> int main(void) { ]; int i,k; while(gets(a)!=NULL) { ...
- Problem D: 零起点学算法95——弓型矩阵
#include<stdio.h> #include<string.h> int main() { ][]; while(scanf("%d%d",& ...
- Problem F: 零起点学算法42——多组测试数据输出II
#include<stdio.h> int main() { ; while(scanf("%d%d%d",&a,&b,&c)!=EOF) { ...
- Problem E: 零起点学算法34——3n+1问题
#include<stdio.h> #include<math.h> int main() { int n; n<=pow(,); ; scanf("%d&qu ...
- Problem K: 零起点学算法107——统计元音
#include<stdio.h> int main() { int n; ]; while(scanf("%d%*c",&n)!=EOF) { while(n ...
- Problem J: 零起点学算法105——C语言合法标识符
#include<stdio.h> #include<ctype.h>//调用isalpha函数 int main() { int n; ]; while(scanf(&quo ...
随机推荐
- 设计模式之Prototype
设计模式总共有23种模式这仅仅是为了一个目的:解耦+解耦+解耦...(高内聚低耦合满足开闭原则) 介绍: 用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象. 为什么要用Prototype ...
- 【shell】shell中各种括号的作用()、(())、[]、[[]]、{}
一.小括号,圆括号() 1.单小括号 () ①命令组.括号中的命令将会新开一个子shell顺序执行,所以括号中的变量不能够被脚本余下的部分使用.括号中多个命令之间用分号隔开,最后一个命令可以没有 ...
- Mel倒谱系数
Mel倒谱系数:MFCC Mel频率倒谱系数(Mel Frequency Cepstrum Coefficient)的缩写是MFCC,Mel频率是基于人耳听觉特性提出来的,它与Hz频率成非线性对应关系 ...
- 【学习笔记】动态树Link-Cut-Tree
这是两个月前写的,看能不能搬运过来…… 动态树是一类维护森林连通性的问题(已纠正,感谢ZQC巨佬),目前最(wo)常(zhi)见(hui)的动态树就是LCT(Link-Cut-Tree),然而LCT似 ...
- SQL语句获取时间的方法
1. 当前系统日期.时间select getdate() 2. dateadd 在向指定日期加上一段时间的基础上,返回新的 datetime 值例如:向日期加上2天select dateadd(day ...
- MiCode 40: 找小“3”
题目链接 这道题真的是zjb恶心, 看其起来像是个数位dp, 然而我并不会数位dp.然后就xjb乱写了个雷类似于动态规划的玩意, 然后调出了\(9\times 9 = 81\)种Bug, 终于过了. ...
- session和cookie基本操作
session的作用同cookie一样: 1.在不同页面使用同一数组 2.实现验证码,用户跟踪(个人觉得这个用到的其实还是1中的作用) session相对于cookie更加的安全 先来说一下cooki ...
- poj 1088(记忆化搜索)
滑雪 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 88560 Accepted: 33212 Description ...
- Populating Next Right Pointers in Each Node I&&II ——II仍然需要认真看看
Populating Next Right Pointers in Each Node I Given a binary tree struct TreeLinkNode { TreeLinkNode ...
- Centos7下安装破解confluence6.3
confluence是一个专业的企业知识管理与协同软件,可以用于构建企业wiki.通过它可以实现团队成员之间的协作和知识共享.现在大多数公司都会部署一套confluence与jira的结合,用作内部w ...