# k254. 拍七 (Seven) ## 題目連結: [k254](https://zerojudge.tw/ShowProblem?problemid=k254) ## 解題想法 * 用for迴圈判斷是否為b的倍數或數字裡是否有b * 變數count用來記錄拍手幾下 ## 程式碼 ```python= #input s,e,b,k = map(int,input().split()) #start count = 0 isprint = False for i in range(s,e+1): if str(b) in str(i) or i%b ==0: count += 1 if count == k: print(i) isprint = True #output if isprint == False: print(-1)
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up