Sicily 2005.Lovely Number
题目地址: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的更多相关文章
- Codeoforces 558 B. Duff in Love
// B. Duff in Love time limit per test 2 seconds memory limit per test 256 megabytes input standar ...
- Codeforces Round #326 (Div. 2)-Duff in Love
题意: 一个数x被定义为lovely number需要满足这样的条件:不存在一个数a(a>1),使得a的完全平方是x的因子(即x % a2 != 0). 给你一个数n,求出n的因子中为love ...
- 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 ...
- Codeforces Round #326 (Div. 2) B
1.每一个合数都可以由若干个素数相乘而得到 2.质因数知识 :求一个数因数的个数等于它的每个质因数的次数加一的和相乘的积因为质因数可以不用,所以要加一.例如6=2x3,两个质因数都是一次,如果两个质因 ...
- B. Duff in Love
B. Duff in Love time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...
- 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 ...
- 【243】◀▶IEW-Unit08
Unit 8 Environment I. 不定式(to do)在雅思写作中的运用 1)名词 • 主语(句首) To protect the environment is everyone's dut ...
- Codeforces Round #326 (Div. 2)
B. Duff in Love time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...
- Codeforces 快速竞技#4
快速竞技#4 A–Duff and Meat588A = =这题不知道怎么写题解了.. 直接上code---. #include<bits/stdc++.h> #include<st ...
随机推荐
- 文成小盆友python-num13 整个堡垒机
本节主要内容: 1.pymsql的使用 2.SQLAchemy使用 3.Paramiko 4.通过ORM功能使用和Paramiko的使用实现一个简单的堡垒机模型. 一.pymsql的使用 pymsql ...
- Web之CSS开发技巧: CSS 居中大全
<center> text-align:center 在父容器里水平居中 inline 文字,或 inline 元素 vertical-align:middle 垂直居中 inline 文 ...
- 探讨VMP 2.12.3 导入表修复
壳版本:VMProtect.Ultimate.2.12.3 样本:notepad.exe 目的:IAT修复 作者:MrWrong 标题:探讨VMP 2.12.3 导入表修复 只是感兴趣,没有其他目的. ...
- c++ 高效文本读写
上数据结构课,做project,数据老师要求我们多做测试,而文本文件可以有效记录这些东东,这样我想起了文件的读写,下面是渣渣我个人的一些想法,大神们看见有错的,尽管指出(orz~~~囧,木有人看我的呀 ...
- 转:内核中的内存申请:kmalloc、vmalloc、kzalloc、kcalloc、get_free_pages
在内核模块中申请分配内存需要使用内核中的专用API:kmalloc.vmalloc.kzalloc.kcalloc.get_free_pages;当然,设备驱动程序也不例外;对于提供了MMU功能的处理 ...
- 转:ASCII码表_全_完整版
ASCII码表 ASCII值 控制字符 ASCII值 控制字符 ASCII值 控制字符 ASCII值 控制字符 0 NUL 32 (space) 64 @ 96 . 1 SOH 33 ! 65 A 9 ...
- Storm测试报告
http://blog.csdn.net/jmppok/article/details/17614431
- 51单片机C语言学习笔记4:keil C51绝对地址访问
在利用keil进行8051单片机编程的时,常常需要进行绝对地址进行访问.特别是对硬件操作,如DA AD 采样 ,LCD 液晶操作,打印操作.等等.C51提供了三种访问绝对地址的方法: 1. 绝对宏: ...
- use "man rsyslogd" for details. To run rsyslog interactively, use "rsyslogd -n"to run it in debug mo
zjtest7-frontend:/root# service rsyslog start Starting system logger: usage: rsyslogd [options] use ...
- 在ubuntu上编译chrome
在ubuntu上编译chrome 在ubuntu上编译chrome 红心地瓜 1.获取代码 1)下载tarball,http://chromium-browser-source.commondatas ...