#45948: 不用map用set就可以了


1121228@stu.wghs.tp.edu.tw (你知道我是誰嗎!!??)

學校 : 臺北市立建國高級中學
編號 : 266561
來源 : [60.248.154.139]
最後登入時間 :
2025-05-14 12:52:11
o337. YTPizza | From: [60.248.154.139] | 發表日期 : 2025-05-02 12:50

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
set<int> m;
int N, topping;
cin >> N;
while(N--){
    cin >> topping;
    if(m.find(topping)!=m.end()){
        continue;
    }else{
        cout << topping << ' ';
        m.insert(topping);
    }
}
return 0;
}
 
ZeroJudge Forum