PAT L2 027 名人堂與代金券

2022-07-29 17:30:14 字數 1468 閱讀 2788

對於在中國大學mooc( )學習「資料結構」課程的學生,想要獲得一張合格證書,總評成績必須達到 60 分及以上,並且有另加福利:總評分在 [g, 100] 區間內者,可以得到 50 元 pat 代金券;在 [60, g) 區間內者,可以得到 20 元pat代金券。全國考點通用,一年有效。同時任課老師還會把總評成績前 k 名的學生列入課程「名人堂」。本題就請你編寫程式,幫助老師列出名人堂的學生,並統計一共發出了面值多少元的 pat 代金券。

輸入在第一行給出 3 個整數,分別是 n(不超過 10 000 的正整數,為學生總數)、g(在 (60,100) 區間內的整數,為題麵中描述的代金券等級分界線)、k(不超過 100 且不超過 n 的正整數,為進入名人堂的最低名次)。接下來 n 行,每行給出一位學生的賬號(長度不超過15位、不帶空格的字串)和總評成績(區間 [0, 100] 內的整數),其間以空格分隔。題目保證沒有重複的賬號。

首先在一行中輸出發出的 pat 代金券的總面值。然後按總評成績非公升序輸出進入名人堂的學生的名次、賬號和成績,其間以 1 個空格分隔。需要注意的是:成績相同的學生享有並列的排名,排名並列時,按賬號的字母序公升序輸出。

10 80 5

[email protected] 78

[email protected] 87

[email protected] 65

[email protected] 96

[email protected] 39

[email protected] 87

[email protected] 80

[email protected] 88

[email protected] 80

[email protected] 70

360

1 [email protected] 96

2 [email protected] 88

3 [email protected] 87

3 [email protected] 87

5 [email protected] 80

5 [email protected] 80

**:

#include using namespace std;

const int maxn = 1e5 + 10;

int n, g, k;

int cnt = 0;

int ans = 0;

struct nodenode[maxn];

bool cmp(const node &a, const node &b)

int main()

sort(node, node + n, cmp);

node[0].id = 1;

for(int i = 1; i < n; i ++)

printf("%d\n", ans);

for(int i = 0; i < n; i ++)

}return 0;

}

大半夜改模擬改到自閉 明天繼續 晚安安

L2 027 名人堂與代金券

對於在中國大學mooc 學習 資料結構 課程的學生,想要獲得一張合格證書,總評成績必須達到 60 分及以上,並且有另加福利 總評分在 g,100 區間內者,可以得到 50 元 pat 代金券 在 60,g 區間內者,可以得到 20 元pat代金券。全國考點通用,一年有效。同時任課老師還會把總評成績前...

L2 027 名人堂與代金券

時間限制 150 ms 記憶體限制 65536 kb 長度限制 8000 b 判題程式 standard 作者陳越對於在中國大學mooc 學習 資料結構 課程的學生,想要獲得一張合格證書,總評成績必須達到 60 分及以上,並且有另加福利 總評分在 g,100 區間內者,可以得到 50 元 pat 代...

L2 027 名人堂與代金券 題解

首先,我們來大概看一下這個題 l2 027 名人堂與代金券 25 分 對於在中國大學mooc 學習 資料結構 課程的學生,想要獲得一張合格證書,總評成績必須達到 60 分及以上,並且有另加福利 總評分在 g,100 區間內者,可以得到 50 元 pat 代金券 在 60,g 區間內者,可以得到 20...