Problem F: 零起点学算法85——数组中插入一个数
#include<stdio.h>
int main()
{
int n,a[],b[];
while(scanf("%d",&n)!=EOF)
{
for(int i=;i<n;i++)
{
scanf("%d",&a[i]);
}
int m,k,j=;
scanf("%d%d",&m,&k);
for(int i=;i<n;i++)
{
if(a[i]<m)
{
b[j]=a[i];
j++;
}
else break;
}
b[j]=m;
j++;
for(int i=j-;i<n;i++)
{
b[j]=a[i];
j++;
}
for(int i=;i<j-;i++)
{
printf("%d ",b[i]);
}
printf("%d\n",b[j-]);
printf("%d\n",b[k]);
}
return ;
}
Problem F: 零起点学算法85——数组中插入一个数的更多相关文章
- Problem F: 零起点学算法101——统计字母数字等个数
#include<stdio.h> #include<string.h> int main(){ ]; while(gets(str)!=NULL){ ,b=,c=,d=; ; ...
- Problem D: 零起点学算法83——数组中删数
#include<stdio.h> int main(void) { int n,i,t,x,flag; while(scanf("%d",&n)!=EOF) ...
- Problem E: 零起点学算法84——数组中删数II
#include<stdio.h> int main() { ],b[],i,flag=; while(scanf("%d",&n)!=EOF) { ;i< ...
- Problem C: 零起点学算法82——数组中查找数
#include<stdio.h> int main(void) { ],m; while(scanf("%d",&n)!=EOF) { ;i<n;i++ ...
- 1145: 零起点学算法52——数组中删数II
1145: 零起点学算法52--数组中删数II Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: 293 ...
- 1144: 零起点学算法51——数组中删数(C语言)
题目: 题目来源WUSTOJ 源代码: #include<stdio.h> int main() { int n, m, i, a[20]; while (scanf("%d&q ...
- Problem F: 零起点学算法42——多组测试数据输出II
#include<stdio.h> int main() { ; while(scanf("%d%d%d",&a,&b,&c)!=EOF) { ...
- Problem A: 零起点学算法91——找出一个数组中出现次数最多的那个元素
#include<stdio.h> int main() { ],b[]={}; while(scanf("%d",&n)!=EOF) { ;i<n;i+ ...
- Problem B: 零起点学算法81——找出数组中最大元素的位置(下标值
#include<stdio.h> int main(void) { ],i,max; while(scanf("%d",&n)!=EOF) { ;i<n ...
随机推荐
- eclipse+EGIT+GitHub
下载EGIT:http://wiki.eclipse.org/EGit/FAQ#Where_can_I_find_older_releases_of_EGit.3F 1.下载eclipse版本对应的E ...
- ctsc&apio2018八日游
day0: 早就知道自己是打酱油的..早就做好了打铁的准备.. Q:那你来干嘛 A:当然是来玩啊!!玩啊!啊!! emmmmm 抱着半期考不及格的卷子瑟瑟发抖地上了飞机. day1:报道!当然还有在宾 ...
- python基础===进程,线程,协程的区别(转)
本文转自:http://blog.csdn.net/hairetz/article/details/16119911 进程拥有自己独立的堆和栈,既不共享堆,亦不共享栈,进程由操作系统调度. 线程拥有自 ...
- 64_m2
mimetic-devel-0.9.8-7.fc26.i686.rpm 12-Feb-2017 05:40 288474 mimetic-devel-0.9.8-7.fc26.x86_64.rpm 1 ...
- 【bzoj1024】生日蛋糕
一开始想dp 后来发现既然要均等,又看了下数据条件 暴力就能做. #include<bits/stdc++.h> using namespace std; ; int x,y,n; dou ...
- Centos7 配置网络
/* Centos7 的网络 不可以用ifconfig获取,需要安装包 所以 .*/ //查看ip [root@master ~]# ip a /* Centos7 的网卡名字与 Centos6有区别 ...
- HIbernate学习笔记2 之 主键生成方式
一.hibernate主键生成方式: 1.常用方式:mysql:自增长生成主键(identity) <generator class="identity"> </ ...
- Leetcode 之Wildcard Matching(32)
跟上题类似,主要考虑‘*’的匹配问题.如果遇到‘*’,则跳过继续匹配,如果不匹配,则s++,重新扫描. bool isMatch2(const char *s, const char *p) { if ...
- hive学习(一)hive架构及hive3.1.1三种方式部署安装
1.hive简介 logo 是一个身体像蜜蜂,头是大象的家伙,相当可爱. Hive是一个数据仓库基础工具在Hadoop中用来处理结构化数据.它架构在Hadoop之上,总归为大数据,并使得查询和分析方便 ...
- 《java并发编程实战》读书笔记8--死锁,性能与可伸缩性,锁粒度锁分解锁分段
第10章 避免活跃性危险 10.1 死锁 -10.1.1 锁顺序死锁 最简单的一种死锁形式: -10.1.2 动态的锁顺序死锁 可以通过下面的方法来解决: -10.1.3 在协作对象之间发生死锁 -1 ...