描述

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 $

#include<iostream>
using namespace std;
int main()
{
int n,x;
while(cin>>n&&n)
{
int temp=-1;
while(n--)
{
cin>>x;
if(x!=temp)
{
cout<<x<<" ";
temp=x;
}
}
cout<<"$"<<endl;
}
return 0;
}

  

1089-Duplicate Removal的更多相关文章

  1. 【Leetcode_easy】1089. Duplicate Zeros

    problem 1089. Duplicate Zeros 题意: solution: 其中关于虚拟新数组的下标的计算还是有点迷糊... class Solution { public: void d ...

  2. POJ 3916:Duplicate Removal 将相近的重复元素删除

    Duplicate Removal Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 1745   Accepted: 1213 ...

  3. [LeetCode]1089. Duplicate Zeros

    Given a fixed length array arr of integers, duplicate each occurrence of zero, shifting the remainin ...

  4. 【leetcode】1089. Duplicate Zeros

    题目如下: Given a fixed length array arr of integers, duplicate each occurrence of zero, shifting the re ...

  5. LeetCode 1089. 复写零(Duplicate Zeros) 72

    1089. 复写零 1089. Duplicate Zeros 题目描述 给你一个长度固定的整数数组 arr,请你将该数组中出现的每个零都复写一遍,并将其余的元素向右平移. 注意:请不要在超过该数组长 ...

  6. 【LEETCODE】49、数组分类,简单级别,题目:566,1089

    package y2019.Algorithm.array; /** * @ProjectName: cutter-point * @Package: y2019.Algorithm.array * ...

  7. JavaScript性能优化

    如今主流浏览器都在比拼JavaScript引擎的执行速度,但最终都会达到一个理论极限,即无限接近编译后程序执行速度. 这种情况下决定程序速度的另一个重要因素就是代码本身. 在这里我们会分门别类的介绍J ...

  8. MySQL Information Functions

    Table 12.18 Information Functions Name Description BENCHMARK() Repeatedly execute an expression CHAR ...

  9. AIX 第4章 指令记录

    root@db:/#lsdev -Cc disk --查看磁盘设备信息   -C customized -c class hdisk0       Available 00-08-00 SAS Dis ...

  10. Java 8 Stream API Example Tutorial

    Stream API Overview Before we look into Java 8 Stream API Examples, let’s see why it was required. S ...

随机推荐

  1. createjs 使用记录

    createjs由几个库组成: l,easeljs,这个是核心,包括了显示列表.事件机制: 2,preloadjs,用于预加载图片等: 3,tweenjs,用于控制元件的缓动: 4,soundjs,用 ...

  2. ASP.NET 4.0 来了

    伴随着VS2010的公开测试,ASP.NET4.0也进入了我们的视线.ASP.NET4.0究竟给我们带来了什么,将在哪些方面提高我们的生产力? 在何时你需要使用ASP.NET4.0开发你的网站程序? ...

  3. Ext.Net学习笔记15:Ext.Net GridPanel 汇总(Summary)用法

    Ext.Net学习笔记15:Ext.Net GridPanel 汇总(Summary)用法 Summary的用法和Group一样简单,分为两步: 启用Summary功能 在Feature标签内,添加如 ...

  4. SVN服务器从Windows迁移到Linux

    gerui 2013.9.14 ge-rui@sohu.com 一.备份VisualSVN项目 1. 现在要使用Linux作为svn服务器,之前是在windows Server 2008上的,用的是V ...

  5. leetcode之Count Complete Tree Nodes

    Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from W ...

  6. CSS text-indent

    text-indent 属性规定文本块中首行文本的缩进. 一个作用就是首行文本缩进,一般的文本都是首行缩进两个字符,这里就可以使用text-indent { text-indent: 2em; } 另 ...

  7. FileInputStream 与 BufferedInputStream 效率对比

    我的技术博客经常被流氓网站恶意爬取转载.请移步原文:http://www.cnblogs.com/hamhog/p/3550158.html ,享受整齐的排版.有效的链接.正确的代码缩进.更好的阅读体 ...

  8. Linux与Windows的桥梁--共享目录

    1.关闭防火墙和selinux         # service iptables stop         # chkconfig --level 2345 iptables off        ...

  9. CSS选择器,标签限定

    例子:ul#nav, ul li#nav和 #nav ul, #nav ul li 注意空格,没有空间隔开的就可以理解为限定 区别 1.ul#nav:表示id='nav'的ul:(ul限定#nav标签 ...

  10. width() innerwidth() outerwidth() css('width')

    不多说,用一图足以说明 首先先解释下普通元素和非普通元素, 非普通元素是指window,document这些 元素对象, 普通元素是指除window,document之外的元素,如:div 对于普通的 ...