Python水题记录

1 Codeforces 915A Garden

 1 #!/usr/bin/env python
 2 # coding: utf8
 3 
 4 import sys
 5 
 6 def main():
 7     #sys.stdin = open('A.in', 'r') 
 8     #sys.stdout = open('A.out', 'w') 
 9     n, k = map(int, raw_input().split())
10     a = map(int, raw_input().split())
11     ans = 100
12     for i in a:
13         if k % i == 0 and k / i < ans:
14             ans = k / i
15     print ans
16 
17 if __name__ == "__main__":
18     main()
View Code
 1 #!/usr/bin/env python
 2 # coding: utf8
 3 
 4 import sys
 5 
 6 def main():
 7     #sys.stdin = open('A.in', 'r') 
 8     #sys.stdout = open('A.out', 'w') 
 9     n, k = map(int, raw_input().split())
10     a = map(int, raw_input().split())
11     ans = 0
12     a.sort(reverse = True)
13     for i in a:
14         if k % i == 0:
15             ans = k / i
16             break
17     print ans
18 
19 if __name__ == "__main__":
20     main()
View Code

 

2 Codeforces 914A Perfect Squares

 1 #!/usr/bin/env python
 2 # coding: utf8
 3 
 4 import sys
 5 
 6 def main():
 7     #sys.stdin = open('A.in', 'r') 
 8     #sys.stdout = open('A.out', 'w') 
 9     n = int(raw_input())
10     a = map(int, raw_input().split())
11     s = set(x * x for x in xrange(0, 1001))
12     print max(x for x in a if x not in s)
13 
14 if __name__ == "__main__":
15     main()
View Code

 

3 Codeforces 914B Conan and Agasa play a Card Game

 1 #!/usr/bin/env python
 2 # coding: utf8
 3 
 4 import sys
 5 from collections import defaultdict
 6 
 7 def main():
 8     #sys.stdin = open('A.in', 'r') 
 9     #sys.stdout = open('A.out', 'w') 
10     n = int(raw_input())
11     a = map(int, raw_input().split())
12     d = defaultdict(int)
13     for x in a:
14         d[x] += 1
15     print 'Conan' if any(x % 2 for x in d.values()) else 'Agasa'
16 
17 if __name__ == "__main__":
18     main()
View Code

 

转载于:https://www.cnblogs.com/zhaoyz/p/8282675.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值