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 ...
随机推荐
- Asp.net禁用页面缓存的方法
方法1.在Asp页面首部<head>中添加如下代码 Response.Buffer = True Response.ExpiresAbsolute = Now() - 1 Response ...
- 关于Layouts的分类
ViewGroup ---------------------------------LinearLayout.Relative Layout. AdapterView --------------- ...
- web api 2 学习笔记 (Odata ODataQueryOptions 使用)
[ODataRoutePrefix("products")] public class ProductController : BaseController { [ODataRou ...
- Cracking the coding interview--Q1.6
原文: Given an image represented by an NxN matrix, where each pixel in the image is 4 bytes, write a m ...
- 使用Mono Runtime Bundle制作安装包让C#桌面应用程序脱离net framework
在Xamain 未被收购之前,这货monodroid.exe 就是一个打包的绑定...无奈 配置环境复杂,未能实现 ...有mono运行时就行了..不折腾了 玛德 让C#程序独立运行(脱离 .NET ...
- centos6.5+Django+mysql+nginx+uwsgi
centos6.5+Django+mysql+nginx+uwsgi 1.nginx的安装.这里采用nginx-1.6.0, 建立一个shell脚本然后执行. #!/bin/bash nginx_ve ...
- jzp线性筛及其简单应用
前言: 很久以前看过了线性筛,没怎么注意原理,但是后来发现线性筛还有很有用的.. 比如上次做的一道题就需要找出每个数的最小质因子,先筛再找就太慢了..一看线性筛发现就可以直接在筛的过程中处理出来了! ...
- appium 使用findElementByAndroidUIAutomator 定位元素示例
appium 使用findElementByAndroidUIAutomator 定位元素示例 import io.appium.java_client.remote.MobileCapability ...
- ORACLE REFERENCES FRO TEST
[JSU]LJDragon's Oracle course notes In the first semester, junior year Oracle考前复习 试题结构分析: 1.选择题2x10, ...
- SMO启发式选择
%% % svm 简单算法设计 --启发式选择 %% clc clear close all % step=0.05;error=1.2; % [data, label]=generate_sampl ...