Problem D: 零起点学算法83——数组中删数
#include<stdio.h>
int main(void)
{
int n,i,t,x,flag;
while(scanf("%d",&n)!=EOF)
{
int a[];
t=n;
flag=;
for(i=;i<n;i++)
scanf("%d",&a[i]);
scanf("%d",&x);
for(i=;i<n;i++)
{
if(a[i]==x)
{
t=i;
break;
}}
for(i=;i<n;i++)
{
if(i!=t)
{
if(flag)
{
printf("%d",a[i]);
flag=;
}
else
printf(" %d",a[i]);
}
}
printf("\n");
}
return ;
}
Problem D: 零起点学算法83——数组中删数的更多相关文章
- Problem E: 零起点学算法84——数组中删数II
#include<stdio.h> int main() { ],b[],i,flag=; while(scanf("%d",&n)!=EOF) { ;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: 零起点学算法85——数组中插入一个数
#include<stdio.h> int main() { ],b[]; while(scanf("%d",&n)!=EOF) { ;i<n;i++) ...
- Problem C: 零起点学算法82——数组中查找数
#include<stdio.h> int main(void) { ],m; while(scanf("%d",&n)!=EOF) { ;i<n;i++ ...
- 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 ...
- Problem A: 零起点学算法80——逆序输出(数组练习)
#include<stdio.h> int main() { ]; scanf("%d",&n); ;i<=n;i++){ scanf("%d& ...
- Problem G: 零起点学算法102——删除字符
#include<stdio.h> #include<string.h> int main() { ],a; while(gets(ch)!=NULL) { scanf(&qu ...
随机推荐
- vim 实现括号以及引号的自动补全
编辑文件/etc/vim/vimrc sudo vim /etc/vim/vimrc 在最后添加 inoremap ( ()<ESC>i inoremap [ []<ESC>i ...
- System and method to prioritize large memory page allocation in virtualized systems
The prioritization of large memory page mapping is a function of the access bits in the L1 page tabl ...
- 1833: [ZJOI2010]count 数字计数——数位dp
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1833 省选之前来切一道裸的数位dp.. 题意 统计[a,b]中0~9每个数字出现的次数(不算 ...
- 2017多校第6场 HDU 6105 Gameia 博弈
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6105 题意:Alice和Bob玩一个游戏,喷漆!现在有一棵树上边的节点最开始都没有被染色.游戏规则是: ...
- 1.ubuntu的安装
分两种 1. 在VMware中安装,则与Centos的安装类似 2. 在VirtualBox里安装 --> 1. 先“新建” 一个虚拟电脑 2. 根据需求编辑虚拟电脑的信息 (具体的大小.内存等 ...
- Linux系统编程——进程间通信(一)
基本操作命令: ps -ajx/-aux/-ef 查看进程间状态/的相互关系 top 动态显示系统中的进程 nice 按照指定的优先级运行 /renice 改变正在运行的进程的优先级 kill -9杀 ...
- shell中引号的作用(转)
引号的作用 1 双引号(“”) 1)使用””可引用除字符$(美元符号).`(反引号).\(反斜线)外的任意字符或字符串.双引号不会阻止shell对这三个字符做特殊处理(标示变量名.命令替换.反斜线转义 ...
- 多路复用I/O模型select() 模型 代码实现
多路复用I/O: socket编程之select(),poll(),epoll() 代码: client.c #include <stdio.h> #include <sys/ty ...
- Insertion Sort List——链表的插入排序
Sort a linked list using insertion sort. 这道题跟 Sort List 类似,要求在链表上实现一种排序算法,这道题是指定实现插入排序.插入排序是一种O(n^2) ...
- SecureCrt的操持连接办法
保持连接: options -> global options -> General -> Default Session,点击Edit default settings按钮,在Te ...