#43740: 解題思維(python程式內容,思維各種語言即可參考)english version


tsengdean2013@gmail.com (Dean)

School : No School
ID : 269223
IP address : [118.232.1.179]
Last Login :
2024-07-14 10:58:49
n361. 數字旅館 (hotel) -- TOI練習賽202403新手組第2題 | From: [123.195.40.217] | Post Date : 2024-10-27 11:12

First, input how many numbers would be inputed use input.split() to make them into a list
then, use a for loop to calculate each number one by one, using the list we just created index i(list[i])
if the number should be in the 1st apartment, it %6 == 0
elif if the number is in the 2nd apartmenet it should be a odd number and %3 != 0
elif the number is in the 3rd apartment, it would be   (num ** 0.5) % 1 == 0 or (num % 7 != 0 and num % 2 == 0)

else, if none of the judgements are true, print(0)

 
ZeroJudge Forum