牛津大學(xué)編程思維挑戰(zhàn)賽(The Oxford University Computing Challenge-OUCC)根據(jù)難度分為初級(jí)、中級(jí)、高級(jí)和精英級(jí)四個(gè)等級(jí),分別對(duì)應(yīng)小學(xué),初中和高中。
該學(xué)術(shù)活動(dòng)新賽季報(bào)名時(shí)間已公布,報(bào)名通道及學(xué)術(shù)活動(dòng)真題開(kāi)放中!
學(xué)術(shù)活動(dòng)時(shí)間:
2022年5月8日14:00-15:00(60 分鐘)
Sorting Pairs
A set of pairs of integers needs sorting. There are n pairs in the set and the pairs need sorting in ascending order according to the sum of the pair of numbers.
Input format:
An integer,?n, indicating the number of pairs of numbers, followed by up to 20 lines of data, each line consisting of two integers.
Output format:
The sorted pairs of numbers, or the string?sorted?if the set of pairs is already sorted.
Example
Input:
5
0 10
4 10
1 10
3 10
2 10
Output:
0 10
1 10
2 10
3 10
4 10
Constraints:
All numbers are positive integers less than 100.
None of the input data in this task contains pairs of numbers whose sum is the same as any other pair in the same set.
Task:
Write a program that sorts a set of pairs of numbers in ascending order according to the sum of the pair of numbers.
Note: For Java (and similar) programs the grader expects the name of the main class to be: sortingpairs
知識(shí)點(diǎn):
list列表的應(yīng)用
tuple元組的應(yīng)用
dict字典的應(yīng)用
參考代碼:

想要獲取備賽計(jì)劃,考前查缺補(bǔ)漏、重點(diǎn)沖刺
歡迎前來(lái)掃描二維碼咨詢【免費(fèi)領(lǐng)取】歷年學(xué)術(shù)活動(dòng)真題及解析!

以上就是關(guān)于【牛津大學(xué)編程挑戰(zhàn)賽(OUCC)-報(bào)名-真題2】的解答,如需了解學(xué)校/賽事/課程動(dòng)態(tài),可至翰林教育官網(wǎng)獲取更多信息。
往期文章閱讀推薦:
2026五大奧賽中國(guó)隊(duì)斬獲四個(gè)世界第一,全員金牌收官!
??2027年QS最佳留學(xué)城市排名發(fā)布!倫敦位列第三,北美竟無(wú)緣Top10 ?

? 2026. All Rights Reserved. 滬ICP備2023009024號(hào)-1