3月的最后一天,我的代码也学了一阵子了,一点进展没有是不可能的,确实有感觉到进步,只不过如果自己更专心一点,应该进步会更大,三月的最后一天。四月开始加油!!!
这两天发现了杭电ACM的PPT,所以决定按照PPT的顺序来刷题了,所以今天练习的都比较简单。
1090 A+B for Input-Output Practice(II)
#encoding:utf8
#1090 A+B for Input-Output Practice(II)
n=int(raw_input())
l=[]
lst=[]
for i in range(n):
l.append(raw_input().split(‘ ‘))
lst.append(map(int,l[i]))
for i in range(n):
print sum(lst[i])
1091A+B for Input-Output Practice(III)
#encoding:utf8
#1091 A+B for Input-Output Practice(III)
##1下面这段有问题
# l=[]
# n=raw_input().split(‘ ‘)
# n=map(int,n)
# while n<>0:
# l.append(n)
# print l
#
# for i in range(len(l)):
# print sum(l[i])
##2正确答案
lst=[]
num= map(int,raw_input().split(‘ ‘))
while(num!=[0,0]): #题目要求输入0 0结束
lst.append(num)
num=map(int,raw_input().split(‘ ‘)) #这一点还不太清楚为什么要这样写
for i in range(len(lst)):
print sum(lst[i])
##3这段是在网上找的答案,这段只是输入一个值
# list=[]
# num= int(input(‘shuru:‘))
# while(num<>0):
# list.append(num)
# num= int(input(‘shuru:‘))
# print list
1092A+B for Input-Output Practice(IV)
#encoding:utf8
##1092 A+B for Input-Output Practice(IV)
#这道题如果用python做,第一个输入值是可以忽略的,不用其也可以运行,但是第一个数可以用来做判断
l=map(int,raw_input().split(‘ ‘))
s=[]
if (len(l)!=l[0]+1):
print ‘input Error‘
else:
while (l!=[0]): #这部分需要加括号,要不0不返回
s.append(l)
l=map(int,raw_input().split(‘ ‘))
for i in range(len(s)):
print sum(s[i][1:])
1093 A+B for Input-Output Practice(V)
#encoding:utf8
##1093 A+B for Input-Output Practice(V)
n=int(raw_input())
l=[]
for i in range(n):
l.append(raw_input().split(‘ ‘))
l[i]=map(int,l[i])
for i in range(n):
print sum(l[i][1:])
1094 A+B for Input-Output Practice(VI)
#encoding:utf8
##1094 A+B for Input-Output Practice(VI)
while True:
l=raw_input().split(‘ ‘)
l=map(int,l)
print sum(l[1:])
1048The Hardest Problem Ever
#encoding:utf8
##1048 The Hardest Problem Ever
#这道题不知道为什么输入ENDOFINPUT就是结束不了,结果返回的也不对要
flag=raw_input()
lst=[]
while(flag!=‘ENDOFINPUT‘):
flag=raw_input()
print flag
while(flag!=‘END‘):
if flag==‘START‘:
l=raw_input().split(‘ ‘)
print l
for i in l:
for j in i:
if j>=‘A‘ and j<=‘E‘:
m=ord(j)+21
else:
m=ord(j)-5
print m
lst.append(chr(m))
print lst
#
# l=[]
# lst=[]
# if (n==‘START‘ and n!=‘END‘):
# #while(n!=‘END‘):
# l=raw_input().split(‘ ‘)
# for i in l:
# for j in i:
# m=ord(j)-5
# lst.append(chr(m))
# elif (n==‘END‘):
# print lst
# elif (n==‘ENDOFINPUT‘):
# print
1018big number
#encoding:utf8
##1018 big number
def factiorial(n):
if n==1:
return 1
else:
return n*factiorial(n-1)
n=int(raw_input())
s=[]
l=[]
for i in range(n):
l.append(raw_input())
l=map(int,l)
for i in range(n):
s.append(factiorial(l[i]))
m=len(str(s[i]))
print m
1013 Digital Roots
#encoding:utf8
##1013 Digital Roots
n=int(raw_input())
l=[]
while (n!=0):
l.append(n)
n=int(raw_input())
# print l
for i in l:
m=i%10
# print ‘m=‘,m
n=i/10
sum=m+n
# print ‘n=‘,n
if sum<=10:
print sum
else:
m=sum%10
# print m
n=sum/10
# print n
print m+n
1089A+B for input-output paractice(I)
#encoding:utf8
#1089A+B for input-output paractice(I)
while True:
n=raw_input().split(‘ ‘)
n=map(int,n)
print sum(n)
1095A+B for input-output paractice(VII)
#encoding:utf8
##1095A+B for input-output paractice(VII)
while True:
n=raw_input().split(‘ ‘)
n=map(int,n)
print sum(n),‘\n‘
1096A+B for input-output practice(VIII)
#encoding:utf8
##1096 A+B for input-output practice(VIII)
n=int(raw_input())
l=[]
lst=[]
for i in range(n):
l.append(raw_input().split(‘ ‘))
lst.append(map(int,l[i]))
for i in range(n):
print sum(lst[i][1:]),‘\n‘
#另一种输出形式,输入一行输出一行
# n=int(raw_input())
# l=[]
# lst=[]
# for i in range(n):
# l.append(raw_input().split(‘ ‘))
# lst.append(map(int,l[i]))
# print sum(lst[i][1:]),‘\n‘
时间: 2024-10-16 04:46:38