首页 > 编程语言 > 详细

acm python

时间:2015-09-17 00:49:15      阅读:251      评论:0      收藏:0      [点我收藏+]

1 diamond 

  *

 **

***

 **

  *

n = 5
_max = 2 * n - 1
a = [("*"*e).center(_max," ")for e in [2*i - 1 if i<=n else 4*n-2*i-1 for i in range(1,_max+1)]]
for each in a:
    print each

2 prime in 100

for prime_num in range(2,101):
  for factor in range(2,prime_num/2):
    if prime_num%factor ==0:break
  else:
    print prime_num

3 abc -> bcd

技术分享
#!/usr/bin/env python
#coding:utf-8

import sys

t = int(raw_input())
cases = 0

while t>0:
    t = t-1
    cases = cases+1
    line = raw_input()
    res = []
    for ch in line:
        if ch==Z:
            res.append(A)
        else:
            res.append(chr(ord(ch)+1))
    print "String #%d" % cases
    for ch in res:
        sys.stdout.write("%c" % ch)
    print \n
View Code

var

acm python

原文:http://www.cnblogs.com/iljyya/p/4814996.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!