描述

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. Activiti 工作流会签开发设计思路

    http://man1900.iteye.com/blog/1607753 在流程业务管理中,任务是通常都是由一个人去处理的,而多个人同时处理一个任务,这种任务我们称之为会签任务.这种业务需求也很常见 ...

  2. 使用MVCJqGrid的心得

    最近公司网站进行升级,项目要用.net mvc,mysql和轻量级orm框架dapper.由于美工页面出不来啊,让我先写简单写写后台的列表,同事说用MvcJqGrid,也得到了架构的同意. 可是不得不 ...

  3. MySQL类型属性Unsigned与ZeroFill

    1. Unsigned 就是将数字类型无符号化. int的类型范围是-2147483648~2147483647, int unsigned的类型范围是0~4294967295 Unsigned也可能 ...

  4. 复制pdf文字出来是乱码的一种可能的解决方案

    最近在处理一个pdf文件,是一个地图文件,上面带各种文字的标注,地图比较大,而且文字信息比较多而且分散.因为字体的问题,在我的windows电脑上虽然可以正常显示,但是复制出来的文字都是方块,而且对应 ...

  5. 从V$SQL_PLAN中FORMAT执行计划

    10G版本 select sql_id from v$sqlarea where sql_text like'%xxx%'; select  * from v$sql_plan where sql_i ...

  6. invalid code signing entitlement的通用暴力解决办法

    1.添加的一台苹果设备为开发机子后,打版本,说profile 没找到,报错 2.上传二进制文件到itunes connect ,报错 3.有时候还什么 appID 无效,报错 烦死他了 我的解决办法, ...

  7. 第二篇、HTML5新增标签

    <html> <head> <meta charset="UTF-8"> <title>html5新增的标签</title&g ...

  8. 12天学好C语言——记录我的C语言学习之路(Day 11)

    12天学好C语言--记录我的C语言学习之路 Day 11: 因为指针部分比较的难,所以我们花费的时间也是最长的,希望大家耐的住性子,多多理解,多多打代码.好了,废话不多说,来看第11天的学习. //编 ...

  9. table表格中加入<a>标签,使内容上下居中的方法。

    主要思路:定义好表格单元格的width和height,再加入<a>后,设置<a>的width=100%,height=100%填充整个单元格.那么此时设置上下左右居中样式就只需 ...

  10. 【开发】Form Validate 表单验证 扩展应用

    目录: ★.文本输入框(easyui-textbox) ★.数字框(easyui-numberbox) ★.时间(easyui-datebox) ★.文本域(easyui-textbox easyui ...