1
台灣大學資訊工程學系 107 學年度轉系考
計算機程式設計考試注意事項
壹、 考試規則
一、每人限定使用一台電腦,需於限定時間內測試完畢。
二、考試時間 2 小時。
三、考試試題以英文命題,可攜帶紙本字典,嚴禁電子字典。
四、輸入與輸出全為純文字資料,每筆輸入資料可能包含多組測試資料。程式應在開始執 行後不經由任何手動操作,自動由標準輸入 (standard input) 讀取資料,並將結果輸 出至標準輸出 (standard output) 後立刻結束程式。
五、每一題最多能上傳 15 次。15 次內上傳結果最高分為該題成績。
六、可攜帶一本紙本參考書。計算紙由試場提供。禁止攜帶任何電子通訊儲存設備。
七、禁止上傳惡意程式碼,違者取消考試資格,並報校以考試舞弊論處。
八、考試環境
1. 程式語言 C,依照 C99 標準。
2. 開發環境與編輯器
Windows 7:Dev-C++ 5.7.1 (gcc 4.8.1)、Code::Blocks 10.05、MINGW32 (gcc 4.6.1)、Notepad++、Micosoft Visual Studio 2008/2010、VIM 7.3
Ubuntu 14.04:VIM 7.4、gedit、GNU Emacs 24.3.1、gcc 4.8.2 3. 編譯參數與運行參數
4. 系統回報訊息共有以下七種:
AC (Accept): 表示通過所有測試資料。
CE (Compile Error): 表示編譯錯誤,並在訊息中列出完整錯誤訊息。
WA (Wrong Answer): 表示部份答案錯誤。
TLE (Time Limit Exceed): 表示執行超過時間限制。
MLE (Memory Limit Exceed): 表示執行超過記憶體限制。
OLE (Output Limit Exceed): 表示輸出檔案超過限制大小。
RE (Runtime Error): 表示執行時發生錯誤。
$ gcc –O2 –std=c99 main.c -o main –lm
$ ./main <test.in >test.out
2
貳、 考試時程
一、考試時間表
時間 內容
10:00 ~ 10:30 考前說明與機器測試 (30 分鐘)
10:30 ~ 12:30 考試 (2 小時)
二、考試地點:資訊工程系館 204
三、考試中途若需上廁所,需經監考人員許可。
四、若對題目有所疑慮,舉手向監考人員遞交提問單,提問將統一顯示在系統頁面上。
五、考試尚未結束前,考生不得離場。
參、 聯絡方式
聯絡人:周承滿小姐
電話: (02) 3366-4888#250 Email:[email protected]
3
肆、 試題範例
參考解答
Problem Description
Write a program to read two integers 𝑎 and 𝑏, then print 𝑎 + 𝑏 in a line.
Input Format
Input contains several datasets. Each dataset consists of two integers 𝑎 and 𝑏 in a line.
0 < 𝑎, 𝑏 < 220
Output Format
For each dataset, print an integer 𝑎 + 𝑏 in a line.
Sample Input / Sample Output
Sample Input Sample Output 5 6
9 6
11 15
Test data
0.in (20 pt.) Time limit: 1 seconds, Memory limit: 64 megabytes.
1.in (80 pt.) Time limit: 3 seconds, Memory limit: 64 megabytes.
#include <stdio.h>
int main() { int a, b;
while (scanf("%d %d", &a, &b) != EOF) printf("%d\n", a+b);
return 0;
}