# | Problem | Pass Rate (passed user / total user) |
---|---|---|
12877 | Simple Calculator |
|
12878 | The Easiest Fortune Telling |
|
Description
請試著實作一個簡易的計算機;計算機可以輸入兩個整數,並實現加、減、乘、除四個功能
給定一個字元和兩個整數。計算機可以透過字元來判斷要進行什麼樣的運算,最後呈現兩個整數運算過後的成果
舉例:
- 如果字元是’+’,兩個整數分別為7、8,則最後輸出結果為15
- 如果字元是’*’,兩個整數分別為2、3,則最後輸出結果為6
Input
一個字元、兩個整數 Op(operator), Num1, Num2
Note:
- Op僅可能為’+’、’-‘、’*’、’/’其中一種字元,分別代表使用加法、減法、乘法、除法
- −181 >= Num1, Num2 >= 181
Output
輸出比須符合以下格式:
Num1 Op Num2 = Num3
Note:
- 輸出的最後必須要有一個換行符號 ('\n')
- 當進行加法或減法運算時,Num2必為非負整數 E.g. (X) 2 + -3 = -1 (O) 2 - 3 = -1, (X) 0 - -1 = 1 (O) 0 + 1 = 1
- Num3是一個四捨五入到整數位的整數
- 若進行除法運算且除數為0時,請印出”NaN”
E.g.
Input:
/ 5 0
Output:
NaN
Sample Input Download
Sample Output Download
Tags
Discuss
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:
- Need to have a return value('\n') at the end of your string.
- X is one of “Xiong”, “Mo-Ji ”, “Xiao-Ji”, “Da-Ji ”.
- 兇 = Xiong; 末吉 = Mo-Ji; 小吉 = Xiao-Ji; 大吉 = Da-Ji.