PAT Advanced 1041
来源:互联网 发布:获取intent数据 编辑:程序博客网 时间:2024/06/11 00:35
题意:
给你一些数,让你判断有哪些数是只有一个的,然后打印出最先unique的那个数。
注意10^4是有10000,还有数字大小是1到10000,N的大小是1到100000.
#include<iostream>#include<fstream>#include<string>using namespace std;int t;int number[111111];int rep[11111];int unique=-1;void solve(){bool flag = true;for (int i = 1; i <= t; i++){if (rep[number[i]] == 1&&flag){unique = number[i];flag = false;}}if (unique == -1){cout << "None" << endl;}elsecout << unique << endl;}void input(){cin >> t;int temp;for (int i = 1; i <= t; i++){cin >> number[i];rep[number[i]]++;}solve();}int main(){input();return 0;}
0 0
- PAT Advanced 1041
- Pat(Advanced Level)Practice--1041(Be Unique)
- PAT Advanced 1065
- PAT Advanced 1001
- PAT Advanced 1043
- PAT Advanced 1042
- PAT Advanced 1067
- PAT Advanced 1066
- PAT Advanced 1005
- pat advanced 1044
- pat advanced 1042
- pat advanced 1043
- pat advanced 1032
- pat:1002(Advanced)
- pat advanced 1050
- pat advanced 1051
- pat advanced 1046
- pat advanced 1054
- myeclipse中项目的替换jar包的时候出现的错误
- 深入理解Activity(小补充)
- 编辑距离
- 找一个字符串中重复的最长子序列
- Direct-X学习笔记--骨骼动画进阶
- PAT Advanced 1041
- 排序算法之Java实现1——冒泡排序算法
- NSNotification大白话
- mysql常用命令
- 初学软件工程——(一、二章)
- hdu1069
- linux下杀死进程(kill)的N种方法
- 解决Sublime Text 3 乱码
- 1003. 我要通过!(20)