HW01 評分標準

1.1 Print Colorful Words

測試資料比例分配

依照題目敘述,"human name"指的是

  • Linus the Torvald (Linus)
  • RMS
  • Turing
  • von Neumann
  • Moore

所有有出現上述的"human name"都要上色

  1. 輸出完整文章: +8pt (文章段落之間若未空一行: -2pt)
  2. 文章被雙引號包住範圍為紅色: +2pt
  3. 所有的人名為藍色: +5pt (+1pt/name)
  4. 五個人的介紹包括處理上色狀況: +5pt (+1pt/person)
  5. 其他有特別錯誤以及其問題斟酌扣分

1.2 Multiplication

測試資料比例分配

  1. 能夠正確地顯示輸入及加法答案: 16pt(2pt/testcase)
  2. 錯誤判斷: 4pt

Subtask 1(16 pts)

第 1 ~ 8 筆測資(t0201.in ~ t0208.in)給分如下:

  1. 完全正確: 2pt / testcase
  2. 錯誤: 0pt / testcase

若1位數 * 2位數直接輸出答案會算做正確

testcase1

input:

34
12

output:

    3 4
*)  1 2
-------
    6 8
  3 4
-------
  4 0 8

testcase2

input:

5
24

output:

      5
*)  2 4
-------
    2 0
  1 0
-------
  1 2 0

testcase3

input:

22
30

output:

    2 2
*)  3 0
-------
      0
  6 6
-------
  6 6 0
testcase4

input:

68
23

output:

      6 8
*)    2 3
---------
    2 0 4
  1 3 6
---------
  1 5 6 4
testcase5

input:

4
2

output:

  4
*)2
---
  8
testcase6

input:

4
18

output:

    4
*)1 8
-----
  3 2  
  4
-----
  7 2  
testcase7

input:

34
9

output:

    3 4
*)    9
-------
  3 0 6 
testcase8

input:

99
99

output:

      9 9
*)    9 9
---------
    8 9 1
  8 9 1
---------
  9 8 0 1

Subtask 2(4 pts)

第 9 ~ 10 筆測資(t0209.in ~ t0210.in)給分如下:

  1. 正確輸出錯誤訊息: 2pt / testcase
testcase9

input:

100
30

output:

Wrong input, your input must between 0 ~ 99.
testcase10

input:

0
-23

output:

Wrong input, your input must between 0 ~ 99.

1.3 Area

TA Hint:

  1. 若對這個題目沒有想法,可以參考 截距式 等關鍵字,並搜尋得到 x y 截距的演算法><
  2. 記得要在計算面積時全程使用浮點數,若不這麼做可能會導致計算結果有落差!
  3. 輸入是 32-bit integers,也就是可能會有 0 或是負整數的輸入ㄛ
  4. 如何將輸出 Area 四捨五入至小數點後兩位,可以查查 printf %.2f 等關鍵字。

正解及測試資料檔案:https://drive.google.com/file/d/1Eukr0YkvTWeEYyuzPpgAjCaOiiEzMGPh/view?usp=sharing

測試資料比例分配

  • Subtask 1. 錯誤測資或極端測資
  • Subtask 2. 輸入皆為正整數的測資
  • Subtask 3. 輸入會包含負整數的測資

Subtask 1(4 pts)

第 1 ~ 4 筆測資(t0301.in ~ t0304.in)給分如下:

  1. 輸出第三行 Area: 後能夠正確地報錯: 1pt / testcase

Subtask 2(8 pts)

第 5 ~ 8 筆測資(t0305.in ~ t0308.in)給分如下:

  1. 輸出第三行 Area: 後能夠正確地顯示 Area : 2pt / testcase

Subtask 3(8 pts)

第 9 ~ 12 筆測資(t0309.in ~ t0312.in)給分如下:

  1. 輸出第三行 Area: 後能夠正確地顯示 Area : 2pt / testcase

扣分情況

  • 四捨五入錯誤 -1pt / testcase
  • 報錯原因錯誤 -1pt / testcase
  • 輸入格式錯誤 整體得分*0.7

1.4 Bidding System for Contract Bridge

測試資料比例分配

  1. HCP 計算: 4 pts
  2. Suit 計算: 4 pts
  3. 叫牌: 10 pts
  4. 錯誤判斷: 2 pts

也就是說,如果你不想做叫牌那個麻煩的判斷,你最多可以拿到 10 分,耶~

評分備註說明

  1. All Correct: 恭喜你,全對!
  2. Wrong Answer = [測資編號],代表你錯了第幾筆測資。其中前面 4 個測資會有(x.1, x.2, x.3),依序代表 HCP、Suit、叫牌。若發現前面 4 筆測資只有出現一個數字(沒有 x.1)的話,代表該筆的 x.1, x.2, x.3 都是錯的。其餘測資都只會有一個數字。
  3. use[]: 如果有出現的話,同時會顯示你使用了甚麼。arrayloop都會在這題成績乘以 0.7,兩個都用會乘以 0.49。
  4. No File: make 之後找不到 ./hw0104
  5. Compile Error: 編譯錯誤QQ

測試資料

Subtask 1(12 pts)

第 1 ~ 4 筆測資(t0401.in ~ t0404.in)給分如下:

  1. HCP 計算正確: 1 pt
  2. Suit 計算完全正確: 1 pt
  3. 叫牌正確: 1 pt
testcase 1

input:

1 14 27 40 2 3 4 5 6 7 8 9 10

output:

---
HCP: 16 pts
Suit: 10-1-1-1
The bidding choice : 1C
testcase 2

input:

11 12 13 24 25 26 28 29 30 31 32 33 34

output:

---
HCP: 12 pts
Suit: 3-3-7-0
The bidding choice : 1D
testcase 3

input:

1 2 3 11 12 13 14 15 16 17 18 19 20

output:

---
HCP: 14 pts
Suit: 6-7-0-0
The bidding choice : 1H
testcase 4

input:

1 3 4 14 15 16 27 28 29 30 48 49 50

output:

---
HCP: 13 pts
Suit: 3-3-4-3
The bidding choice : 1NT

Subtask 2(6 pts)

第 5 ~ 10 筆測資(t0405.in ~ t0410.in)給分如下:

  1. 叫牌正確: 1 pt

若 HCP 或是 suit 計算錯誤不扣分

testcase 5

input:

1 40 41 42 43 44 45 46 48 49 50 51 52

output:

---
HCP: 14 pts
Suit: 1-0-0-12
The bidding choice : 2C
testcase 6

input:

2 3 4 5 6 14 15 16 24 25 26 28 29

output:

---
HCP: 10 pts
Suit: 5-6-2-0
The bidding choice : 2H
testcase 7

input:

1 11 12 13 24 25 26 37 38 39 41 42 43

output:

---
HCP: 22 pts
Suit: 4-3-3-3
The bidding choice : 2NT
testcase 8

input:

11 12 13 24 25 26 37 38 39 40 41 42 43

output:

---
HCP: 22 pts
Suit: 3-3-3-4
The bidding choice : 2NT
testcase 9

input:

2 3 4 5 6 17 40 45 46 48 49 50 52

output:

---
HCP: 8 pts
Suit: 5-1-0-7
The bidding choice : 3C
testcase 10

input:

2 3 4 5 6 7 8 9 10 15 16 17 18

output:

---
HCP: 0 pts
Suit: 9-4-0-0
The bidding choice : PASS

Subtask 3(2 pts)

第 11 ~ 12 筆測資(t0411.in ~ t0412.in)給分如下:

  1. 正確輸出錯誤訊息(不可以輸出錯誤訊息後又輸出叫牌結果): 1 pt
testcase 11

input:

1 14 27 40 2 3 4 5 6 7 8 9 0

output:

---
Wrong Input(or any wrong message)
testcase 12

input:

1 14 27 40 2 3 4 5 6 7 8 9 53

output:

---
Wrong Input(or any wrong message)

其他會扣分或不會扣分項目

會扣分

  1. 任何程式無法正常結束(例如: Segmentation Fault、執行時間超過 10 秒)等,該測資 0 分
  2. 輸出了一些奇怪的東西 -2 分

不會扣分

  1. 格式誤差,例如多/少空白,英文字母大小寫沒寫好

其餘請參照一般評分原則

1.5 How to Write an Email to TA?

每筆測試分數相等,成績四捨五入到整數位。

無論如何,必須明確的 assign 或是 reject。

all-pass-1
ta@csie.cool
[hw1][p1] I need some help
200701090941
all-pass-2
41047000S@gapps.ntnu.edu.tw
[general] What's the answer to the universe?
102030405060708090
error-1-local-1
ta+123@csie.cool
[hw1][p1] I need some help
200701090941
error-2-domain-1
someone123@gmail.com
[hw1][p1] I need some help
200701090941
error-2-domain-2
ta@csie.cooll
[hw1][p1] I need some help
200701090941
error-3-categoty-1
ta@csie.cool
I need some help
200701090941
error-3-categoty-2
ta@csie.cool
[hw1] I need some help
200701090941
error-4-title-1

這題送分喔,有交就有分~
原因:題目對於 category 後有沒有空格並沒有明確指定

error-5-score-1
ta@csie.cool
[hw1][p1] I need some help
-1
error-5-score-2
ta@csie.cool
[hw1][p1] I need some help
10000000000000000001
error-5-score-3
ta@csie.cool
[hw1][p1] I need some help
100000000000

1.6 Bonus: Makefile for Multiple files

  • 有寫出可行的任何一種方法均可得滿分
  • 若用其他方法會先在 Linux 上測試過可以便給分

How to modify this Makefile to make b.c be built even a.c fails.

使用方法一及方法二其中之一,並給出 make 正確範例得滿分 5 分。
方法三並不是 modify this Makefile 可以做到的方式,得 0 分。

GPT4 參考答案

要讓 b.ca.c 編譯失敗時仍能編譯,您有以下幾種方法:

方法一:使用 || true

all:
    gcc a.c -o a || true
    gcc b.c -o b

方法二:使用 - 前綴

all:
    -gcc a.c -o a
    gcc b.c -o b

方法三:使用 -k--keep-going 選項

在命令行中使用 make -kmake --keep-going 命令來執行 Makefile,這樣即使某個目標失敗,也會繼續構建其他目標。

這三種方法都可以確保 b.ca.c 失敗時仍然被編譯。