NOJ1089Duplicate Removal——水题
来源:互联网 发布:向日葵虚拟局域网软件 编辑:程序博客网 时间:2024/05/19 23:27
Duplicate Removal
总提交:188 测试通过:112
描述
The company Al's Chocolate Mangos has a web site where visitors can guess how many chocolate covered mangos are in a virtual jar. Visitors type in a guess between 1 and 99 and then click on a "Submit" button. Unfortunately, the response time from the server is often long, and visitors get impatient and click "Submit" several times in a row. This generates many duplicate requests.
Your task is to write a program to assist the staff at ACM in filtering out these duplicate requests.
输入
The input consists of a series of lines, one for each web session. The first integer on a line is N, 0 < N ≤ 25, which is the number of guesses on this line. These guesses are all between 1 and 99, inclusive. The value N = 0 indicates the end of all the input.
输出
For each input data set, output a single line with the guesses in the original order, but with consecutive duplicates removed. Conclude each output line with the dollar sign character '$'. Note that there is a single space between the last integer and the dollar sign.
样例输入
5 1 22 22 22 3
4 98 76 20 76
6 19 19 35 86 86 86
1 7
0
样例输出
1 22 3 $
98 76 20 76 $
19 35 86 $
7 $
题目来源
ACM Mid-Central Regional 2009
#include<iostream>using namespace std;int a[25];int N;int main(){while(scanf("%d",&N) && N != 0){int tmp, num = 1;scanf("%d",&a[0]);for(int i=1;i<N;i++){scanf("%d",&tmp);if(tmp != a[num-1])a[num++] = tmp;}for(int i=0;i<num-1;i++)printf("%d ",a[i]);printf("%d $\n",a[num-1]);}return 0;}
- NOJ1089Duplicate Removal——水题
- HDU3847——Trash Removal(凸包,枚举)
- 图像处理滤波器(五)——斑点滤波器(Speckle Removal Filter)
- CVPR 2017—Deep Joint Rain Detection and Removal from a Single Image
- POJ 3183 Stump Removal(我的水题之路——高峰烧火,在线判断)
- Usermode api hook removal
- Rootkit Detection and Removal
- Usermode api hook removal
- Hair Removal For Men
- ZERO PAGE removal influence
- W32.Downadup Removal Tool
- POJ 3183 Stump Removal
- Hair Extension Removal
- Rogue Removal Review
- poj 3183 Stump Removal
- Specular Highlight Removal
- POJ 3183 Stump Removal
- Specular Highlight Removal
- NOJ1088Gnome Sequencing——水题
- 火風鼎(1967)
- 【HDU】4291 A Short problem 矩阵快速幂
- BufferedReader BufferedWriter HttpURLConnection
- 解决Maven管理的项目下"Missing artifact xxx bundle"问题
- NOJ1089Duplicate Removal——水题
- 模型驱动测试-多参数测试用例设计敏捷化的一些实践方法
- JVM之二——对象内存的分配和回收
- 澤火革
- 说说大型高并发高负载网站的系统架构(更新)
- NOJ1090Rock, Paper, Scissors——水题
- cocos2d-x-2.2.0_win7+vs2010搭建_eclipse+ndk-r9
- 从入门到精通: 最小费用流的“zkw算法”
- 2013年成都邀请赛解题报告