昨天参加的一个洛谷竞赛,毕竟每周总得打一次比赛。
这次用python打的比赛,IOI赛制的,代码并没有全部通过,第一部分只通过了80%,第二部分只通过了70%
- 第一道题目主要是一个抽象概括的能力,题目读明白用了一段时间,编写代码就几分钟的事情
- 第二道题目题目很直白,直接就是求解
- 第三道题,样例的计算过程没思考明白,卡在最后一个测试点上
- 第四道题,完全没时间看
题目:
立夏
芒种:
代码:
立夏:
#立夏
import os
import sys
import math
t = int(input())
ans = []
for i in range(t):
a = int(input())
ans.append(a)
for i in range(t):
res = 1
tmp = ans[i]
la = tmp%3
if la == 2:
print(0)
continue
if la == 1:
ans = ans
tmp = tmp//3
while tmp:
la = tmp%3
tmp = tmp//3
if la>=1:
res*=math.pow(2,(2-la))
print(int(res))
芒种:
#芒种
import os
import sys
t = int(input())
def bit(n):
s = ''
while n>0:
la = n%2
s =str(la)+s
n = n//2
return s
for i in range(t):
n = int(input())
d = 0
for j in range(n):
a = list(map(int,input().split()))
if a[0] == 1:
d = d*2
else:
d = d+a[1]
if d == 0:
print(0)
else:
print(bit(d))