1080 -- 奇数检测
来源:互联网 发布:嵌入式好还是java好 编辑:程序博客网 时间:2024/06/01 15:01
奇数检测
Time Limit:1000MS Memory Limit:65536K
Total Submit:157 Accepted:48
Description
一个数组存放若干整数,只有一个数出现奇数次,其余数均出现偶数次,找出这个出现奇数次的数?
Input
输入中第一行为一个整数T(1 ≤ T ≤ 10),描述后面一共有T组测试数据。每组测试数据的第一个数为数组的长度n ( n > 0 ),跟着n个数据为数组元数。
Output
输出每组数据中出现奇数次的数。
Sample Input
35 5 5 5 5 67 1 1 2 4 2 3 3 1 1
Sample Output
641
Source
zxw
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace AK1080 { class Program { static void Main(string[] args) { int t = int.Parse(Console.ReadLine()); while (t-- > 0) { string[] s = Console.ReadLine().Split(); int n = int.Parse(s[0]); int[] a = new int[10001]; for (int i = 1; i <= n; i++) a[int.Parse(s[i])]++; for (int i = 0; i < 10001; i++) if (a[i] != 0 && a[i] % 2 == 1) { Console.WriteLine(i); break; } } } } }
0 0
- 1080 -- 奇数检测
- 1256: 奇数检测
- 奇数
- 奇数阶幻方
- 奇数阶幻方
- 奇数阶幻方
- 奇数性
- 奇数因子
- 奇数因子。
- 奇数因子
- 奇数因子
- 奇数因子。。
- 奇数因子
- 奇数因子
- 奇数因子!
- 奇数因子
- 奇数阶幻方
- 奇数因子
- Python爬虫框架Scrapy教程(1)—入门
- mac 下android studio 下载sdk
- 去除inline-block元素间间距的N种方法
- 架构解耦
- unix环境高级编程——文件操作
- 1080 -- 奇数检测
- Apache与Tomcat 区别联系
- 1081 -- 小明A+B(2)
- en_US.UTF-8和zh_CN.UTF-8的区别
- 1082 -- 螺旋矩阵
- Java-位运算符
- 0007.Scala类的属性和对象私有字段实战详解
- strong和weak
- 1083 -- 分!分!分! 学生的命根