题目地址:2005.Lovely Number

思路:

  若测试数据出现的次数为奇数,则输出它。

所以,可以先排序,若前后相等,前后都设为0,最后不为0的则可以输出。

具体代码如下:

 #include <iostream>
#include <algorithm>
using namespace std; int main() {
int t;
while (cin >> t) {
int *array = new int[t];
for (int i = ; i < t; i++) {
cin >> array[i];
}
sort(array, array+t);
for (int i = ; i < t-; i++) {
if (array[i] == array[i+]) {
array[i] = ;
array[i+] = ;
i++; //跳过下一次循环
}
}
for (int i = ; i < t; i++) {
if (array[i] != ) {
cout << array[i] << endl;
}
}
} return ;
}

Sicily 2005.Lovely Number的更多相关文章

  1. Codeoforces 558 B. Duff in Love

    //   B. Duff in Love time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  2. Codeforces Round #326 (Div. 2)-Duff in Love

    题意: 一个数x被定义为lovely number需要满足这样的条件:不存在一个数a(a>1),使得a的完全平方是x的因子(即x % a2  != 0). 给你一个数n,求出n的因子中为love ...

  3. Codeforces Round #326 (Div. 2) B. Duff in Love 分解质因数

    B. Duff in Love Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/588/proble ...

  4. Codeforces Round #326 (Div. 2) B

    1.每一个合数都可以由若干个素数相乘而得到 2.质因数知识 :求一个数因数的个数等于它的每个质因数的次数加一的和相乘的积因为质因数可以不用,所以要加一.例如6=2x3,两个质因数都是一次,如果两个质因 ...

  5. B. Duff in Love

    B. Duff in Love time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  6. Codeforces Round #326 (Div. 2) B Duff in Love 简单数论 姿势涨

    B. Duff in Love time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  7. 【243】◀▶IEW-Unit08

    Unit 8 Environment I. 不定式(to do)在雅思写作中的运用 1)名词 • 主语(句首) To protect the environment is everyone's dut ...

  8. Codeforces Round #326 (Div. 2)

    B. Duff in Love time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...

  9. Codeforces 快速竞技#4

    快速竞技#4 A–Duff and Meat588A = =这题不知道怎么写题解了.. 直接上code---. #include<bits/stdc++.h> #include<st ...

随机推荐

  1. javascript 网页图标音乐切换

    图片名称 sprite.zip <!doctype html> <html> <head> </head> <style> .css{ po ...

  2. sersync做实时同步(第一步)

    两台主机,一台主服务器(192.168.0.109).一台目标服务器(192.168.0.212) 1.配置目标服务器(192.168.0.212);就是配置rsync服务器.在配置文件/etc/rs ...

  3. js前台与后台数据交互

    客户端脚本一般都在前台,这里讲的是(1)在后台调用前台定义的脚本(2)在后台如何注册客户端脚本 用途 何时使用服务器代码向页中添加客户端脚本: u 当客户端脚本的内容依赖于直到运行时才可用的信息时 u ...

  4. Vxworks、QNX、Xenomai、Intime、Sylixos、Ucos等实时操作系统的性能特点

    Vxworks.QNX.Xenomai.Intime.Sylixos.Ucos等实时操作系统的性能特点 VxWorks操作系统 VxWorks 操作系统是美国WindRiver公司于1983年设计开发 ...

  5. ora-01445 无法从不带保留关键字的表的联接视图中选择 ROWID 或采样

    ora-01445无法从不带保留关键字的表的联接视图中选择 ROWID 或采样 从网上找了很多资料,许多都是没结贴的,说什么的都有,排查了一下sql 发现各个段的left join都没有错误. 有一个 ...

  6. mysql 查询每个分组前N条记录

    mysql 查询每个分组前N条记录 假设存在表movie,  有字段 id, part(地区), mcount(观看次数) 现查询每个地区观看次数最多的3部movie, 则表 ###id虽未存在gro ...

  7. data-theme 几种值的样式

    代码片段: <div data-role="page"> <div data-role="header"> <h1>The ...

  8. IIS not allow PUT and DELETE method

    refer : http://stackoverflow.com/questions/10906411/asp-net-web-api-put-delete-verbs-not-allowed-iis ...

  9. 【HDOJ】2585 Hotel

    字符串水题. #include <cstdio> #include <cstring> #include <cstdlib> #define MAXN 55 cha ...

  10. 【转】Win8/8.1/Win7小技巧:揪出C盘空间占用的真凶

    原文网址:http://www.ithome.com/html/win8/55496.htm 不少使用Win8.Win8.1的用户不难发现,原先只占用20G大小的系统盘,随着使用时间的增加,C盘的磁盘 ...