要求
解决方案
import math
import sys
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
byte = input()
count = 0
for i in byte:
if i == "1":
count += 1
print(count * 2)
或者直接调用函数
print(byte.count("1") * 2)
要求
这个挺有意思,主要是对字符串的操作
去掉指定词语,然后组合字符串
解决方案
import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
s = input()
n = int(input())
my_out = str()
for i in range(n):
x = input()
# x里面去掉s这个字符串
x = x.replace(s, '')
my_out += x
print(my_out)
要求
解决方案
import sys
import math
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
n = int(input())
print(n*n*100)
要求
解决方案
import math
import sys
# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.
s = input()
x = str()
for i in range(2, len(s), 3):
x += s[i]
print(x)
注:本文要求的图片来自CodinGame