I found a website that help promotes logical thinking , there will be a period of competition , you can register get start for the competition and get points , Let's take a look at recent matches .
A - November 30
Solution
2019-M2-D2 follows 2019-M1-D1 so we just check M1 & M2 are they equal
m1, d1 = map(int, input().split()) m2, d2 = map(int, input().split()) if m1 == m2: print(0) else: print(1)
B - Tax Rate
Solution
this question the point is rounded down to the nearest integer , math.ceil(N / 1.08) is before tax , round down math.ceil(N / 1.08) times 1.08 to an integer if result equal N Takahashi's memory is true print(result) else false print(":(")
import math N = int(input()) B = math.ceil(N / 1.08) if math.floor(B * 1.08) == N: print(B) else: print(':(')
C - 100 to 105
Solution
if one items cost range is 100~105 , two items is 200 ~210 , three items is 300~315 , and so on ,
each item plus 5 tens digit , so we can get the rules
each item plus 5 tens digit , so we can get the rules
x = int(input()) count = x//100 res = x%100 if count*5 >= res: print(1) else: print(0)
D - Lucky PIN
Solution
Use three loops to get three unique values. Loops meet the condition index value +1 to find the value of the next position
N = int(input()) S = input() cnt = 0 for i in range(10): for j in range(10): for k in range(10): idx = S.find(str(k)) if idx != -1: idx = S.find(str(j),idx+1) if idx != -1: idx = S.find(str(i),idx+1) if idx != -1: cnt += 1 print(k,j,i) print(cnt)to be continued....
沒有留言:
張貼留言