What day is it(邏輯問題)

2021-06-27 22:13:55 字數 1101 閱讀 2304

problem description

today is saturday, 17th nov,2007. now, if i tell you a date, can you tell me what day it is ?

input

there are multiply cases.

one line is one case.

there are three integers, year(0

output

output one line.

if the date is illegal, you should output "illegal". or, you should output what day it is.

sample input

2007 11 17

sample output

saturday

author

lgx

這題一定要注意啊!邏輯錯誤也是硬傷!

首先我們把公元1年1月1日設為星期一

這是我原來的**:

#include int isleap(int y)

else }

int main()

; while (~scanf("%d%d%d",&y,&m,&d))

else

else }

int main()

; while (~scanf("%d%d%d",&y,&m,&d))

else

if (d > ms[m] || d < 1 || m < 1 || m > 12 || y <1 || y>10000)

else

else

if (d > ms[m] || d < 1 || m < 1 || m > 12 || y <1 || y>10000)

你要判斷是否illegal中的

d > ms[m]你就應該先判斷y是否瑞年,因為測試資料在2月設下了關口!我的ms預設是28啊!而判斷放在了上段**後面,無法進行判斷,這是硬傷啊!

邏輯回歸問題

pandas中的iloc方法 在對csv檔案進行讀取的時候,使用iloc方法比較方便,如 對這麼乙個資料進行讀取 0,30.83,0,0,0,9,0,1.25,0,0,1,1,0,202,0,1 1,58.67,4.46,0,0,8,1,3.04,0,0,6,1,0,43,560,1 1,24.5,...

誰是罪犯邏輯問題

今天看到乙個又看到了那個好玩的邏輯問題 抓了a,b,c,d4名犯罪嫌疑人.其中有一名是小偷,審訊中 a說我不是小偷 b說c是小偷 c說小偷肯定是d d說c胡說!其中有3個人說的是實話,乙個人說的是假話,程式設計推斷誰是小偷。以前看到過這個問題,但是當時沒想到好辦法。現在,用python實現一下吧 a...

邏輯回歸問題總結

1.簡介 邏輯回歸是面試當中非常喜歡問到的乙個機器學習演算法,因為表面上看邏輯回歸形式上很簡單,很好掌握,但是一問起來就容易懵逼。所以在面試的時候給大家的第乙個建議不要說自己精通邏輯回歸,非常容易被問倒,從而減分。下面總結了一些平常我在作為面試官面試別人和被別人面試的時候,經常遇到的一些問題。2.正...