#46135: 第一名到第四名會不會也跟第五名成績一樣:)


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

學校 : 臺北市私立薇閣高級中學
編號 : 266561
來源 : [60.248.154.139]
最後登入時間 :
2025-08-21 12:45:57

#include <bits/stdc++.h>
using namespace std;

int main() {
    int N;
    cin >> N;
    int score, others[N-1];
    cin >> score;
    for(int i = 0; i < N - 1; i++) {
        cin >> others[i];
    }
    sort(others, others + N - 1, greater<int>());
    cout << (score > others[4] ? "Top 5" : (score == others[4] ? "Maybe Top 5" : (score >= others[9] ? "Top 10" : "Thank You")));
    return 0;
}
#46141: Re: 第一名到第四名會不會也跟第五名成績一樣:)


mushroom.cs98@g2.nctu.edu.tw (mushroom)

學校 : 國立臺灣大學
編號 : 67469
來源 : [36.227.129.163]
最後登入時間 :
2025-09-07 00:15:11

#include 
using namespace std;

int main() {
    int N;
    cin >> N;
    int score, others[N-1];
    cin >> score;
    for(int i = 0; i < N - 1; i++) {
        cin >> others[i];
    }
    sort(others, others + N - 1, greater());
    cout << (score > others[4] ? "Top 5" : (score == others[4] ? "Maybe Top 5" : (score >= others[9] ? "Top 10" : "Thank You")));
    return 0;
}

回覆標題,對於後 60% 測資的確可能一到五名成績一樣
例如:
[90] 90 90 90 90 90 0 0 0 0 0 那麼 a0 = 90 就是 Maybe Top5
[90] 90 90 90 90  0 0 0 0 0 0 那麼 a0 = 90 就是 Top5