一只小菜鸟的CCF认证备考(3)

一只小菜鸟的CCF认证备考(3)

201912-1
在这里插入图片描述

n = int(input())
i1 = i2 = i3 = i4 =0
i = num = 1
while num < n+1:
    if (i%7 == 0) or ('7' in str(i)):
        if i%4 == 1:
            i1+=1
        elif i%4 == 2:
            i2+=1
        elif i%4 == 3:
            i3+=1
        else:
            i4+=1
    else :
        num += 1
    i += 1
print(i1)
print(i2)
print(i3)
print(i4)
        
        

201912-2
在这里插入图片描述

n =int(input())
x = list()
y = list()
score = list()
scoret = list()
for i in range(0,n):
    xi, yi = map(int,input().split())
    x.append(xi)
    y.append(yi)
    score.append(0)
    scoret.append(0)
score0 = 0
score1 = 0
score2 = 0
score3 = 0
score4 = 0
for i in range(0,n):
    for j in range(i+1,n):
        if x[j] == x[i] :
            if (y[j] == y[i]-1) or (y[j] == y[i]+1):
                scoret[i] += 1
                scoret[j] += 1
        if y[j] == y[i]:
            if (x[j] == x[i]-1) or (x[j] == x[i]+1):
                scoret[i] += 1
                scoret[j] += 1
        if x[j] == x[i] + 1 :
            if (y[j] == y[i]-1) or (y[j] == y[i]+1):
                score[i] += 1
                score[j] += 1
        if x[j] == x[i] - 1 :
            if (y[j] == y[i]-1) or (y[j] == y[i]+1):
                score[i] += 1
                score[j] += 1
    if scoret[i] == 4 :
        if score[i] == 0:
            score0 += 1
        elif score[i] == 1:
            score1 += 1
        elif score[i] == 2:
            score2 += 1
        elif score[i] == 3:
            score3 += 1
        else:
            score4 += 1
print(score0)
print(score1)
print(score2)
print(score3)
print(score4)


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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值