Skip to content

Commit

Permalink
Create zhaoyincreditcard.md
Browse files Browse the repository at this point in the history
  • Loading branch information
0xkookoo authored Sep 16, 2018
1 parent 885c007 commit 7b39b90
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions src/zhaoyincreditcard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
```python
"""第一题"""
gi = [int(i) for i in input().split()]
sj = [int(i) for i in input().split()]
res = 0
for i in sj:
tmp = [j for j in gi if j <= i]
if tmp:
res += 1
gi.remove(max(tmp))
print(res)


"""第二题"""
n = int(input())
if n == 1:
print(1)
elif n == 2:
print(2)
else:
dp = [0] * n
dp[0] = 1
dp[1] = 2
for i in range(2, n):
dp[i] = dp[i-1] + dp[i-2]
print(dp[-1])


"""第三题"""
invalid = ['3', '4', '7']
nochange = ['0', '1', '8']
def good(n):
n = str(n)
for i in invalid:
if i in n:
return False
res = ''
for i in n:
if i in nochange:
res += i
if i == '2':
res += '5'
elif i == '5':
res += '2'
elif i == '6':
res += '9'
elif i == '9':
res += '6'
return res != n

n = int(input())
res = 0
for i in range(n+1):
if good(i):
res += 1
print(res)
```

0 comments on commit 7b39b90

Please sign in to comment.