2096 - IP_2020_YOU_HW2 Scoreboard

Time

2020/09/22 12:00:00 2020/09/29 12:00:00

Clarification

# Problem Asker Description Reply Replier Reply Time For all team

# Problem Pass Rate (passed user / total user)
12877 Simple Calculator
12878 The Easiest Fortune Telling

12877 - Simple Calculator   

Description

請試著實作一個簡易的計算機;計算機可以輸入兩個整數,並實現四個功能

 

給定一個字元和兩個整數。計算機可以透過字元來判斷要進行什麼樣的運算,最後呈現兩個整數運算過後的成果

 

舉例:

- 如果字元是’+’,兩個整數分別為78,則最後輸出結果為15

- 如果字元是’*’,兩個整數分別為23,則最後輸出結果為6

Input

一個字元、兩個整數 Op(operator), Num1, Num2

 

Note:

  1. Op僅可能為’+’’-‘’*’’/’其中一種字元,分別代表使用加法減法乘法除法
  2. −181 >= Num1, Num2 >= 181

Output

輸出比須符合以下格式:

Num1 Op Num2 = Num3

 

Note:

  1. 輸出的最後必須要有一個換行符號 ('\n')
  2. 當進行加法減法運算時,Num2必為非負整數 E.g. (X) 2 + -3 = -1 (O) 2 - 3 = -1, (X) 0 - -1 = 1 (O) 0 + 1 = 1
  3. Num3是一個四捨五入到整數位的整數
  4. 若進行除法運算且除數為0時,請印出”NaN

E.g.

Input:

/ 5 0

Output:

NaN

 

Sample Input  Download

Sample Output  Download

Tags




Discuss




12878 - The Easiest Fortune Telling   

Description

There is a fortune telling method that tells you how your fortune is of the year by calculating the day of the week your birthday falls on that year.

As shown in the table below, if your birthday is Monday in 2020, that means you might be bad luck this year; otherwise, if your birthday is Saturday, that means this year you get an extremely good luck!

Mon

Tue

Wed

Thu

Fri

Sat

Sun

末吉

末吉

小吉

小吉

大吉

小吉

Given two integers to represent the date of one’s birthday. Please Write a C Program to tell their fortune in 2020
.

Input

Two integers M(month), D(day).

Note that M and D follow the date rules in 2020, which means any illegal dates in 2020 like M = 2, D = 30 would not be a test case.

Output

Output should follow below format:

X

Note that:

  1. Need to have a return value('\n') at the end of your string.
  2. X is one of “Xiong”, “Mo-Ji ”, “Xiao-Ji”, “Da-Ji ”.
  3. 兇 = Xiong; 末吉 = Mo-Ji; 小吉 = Xiao-Ji; 大吉 = Da-Ji.

Sample Input  Download

Sample Output  Download

Tags




Discuss