社区讨论
//40分解 给新手看的 STL之威
P2058[NOIP 2016 普及组] 海港参与者 4已保存回复 3
讨论操作
快速查看讨论及其快照的属性,并进行相关操作。
- 当前回复
- 3 条
- 当前快照
- 1 份
- 快照标识符
- @mi5hpfhm
- 此快照首次捕获于
- 2025/11/19 12:16 4 个月前
- 此快照最后确认于
- 2025/11/19 12:16 4 个月前
CPP
//C++ STL的威力
//短短几行,考场手速快的话5,6分钟就可以拿到40分
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main(){
int n , ti , ki , x , m;
vector<int> ship;
cin >> n;
for (int i=1;i<=n;++i){
cin >> ti >> ki;
for (int i=1;i<=ki;++i){
cin >> x;
ship.push_back(x);
}
sort(ship.begin(),ship.end());
m=unique(ship.begin(),ship.end())-ship.begin();
cout << m << endl;
}
return 0;
}
回复
共 3 条回复,欢迎继续交流。
正在加载回复...