【CodinGame】趣味算法 CLASH OF CODE - 20240724


python 复制代码
import sys
import math

# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.

n = int(input())
for i in range(n):
    t, c = [int(j) for j in input().split()]
    if c>14 or t<=0 or t>101:
        print("GLaDOS you filthy liar!")
    else:
        print("That's a cake!")




# print("That's a cake! or GLaDOS you filthy liar!")


python 复制代码
import sys
import math

# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.

x, y = [int(i) for i in input().split()]
n = int(input())
for i in range(n):
    inputs = input().split()
    _dir = inputs[0]
    dist = int(inputs[1])
    if _dir == 'N':
        y += dist
    elif _dir == 'S':
        y -= dist
    elif _dir == 'E':
        x += dist
    elif _dir == 'W':
        x -= dist

print(x,y)



python 复制代码
import sys
import math
from math import log2

# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.

n = int(input())

if log2(n) == int(log2(n)):
    print(int(log2(n)))
else:
    print(-1)


python 复制代码
import sys
import math

# Auto-generated code below aims at helping you parse
# the standard input according to the problem statement.

problem = input()



if eval(problem.replace('?', '+').replace('=', '==')):
    print("+")
if eval(problem.replace('?', '-').replace('=', '==')):
    print("-")
if eval(problem.replace('?', '*').replace('=', '==')):
    print("*")
if eval(problem.replace('?', '/').replace('=', '==')):
    print("/")

eval不安全,看情况使用

END

相关推荐
华科云商xiao徐6 分钟前
突破Python性能墙:关键模块C++化的爬虫优化指南
c++·爬虫·python
楽码9 分钟前
理解自动修复:编程语言的底层逻辑
后端·算法·编程语言
躲在云朵里`20 分钟前
常用Linux指令:Java/MySQL/Tomcat/Redis/Nginx运维指南
开发语言·python
余_弦28 分钟前
区块链中的密码学 —— 零知识证明
算法·区块链·以太坊
小白狮ww1 小时前
蛋白质设计新高度,RFdiffusion 实现从零设计高亲和力蛋白质
人工智能·python·开源
stone51951 小时前
TOTP算法与HOTP算法
c语言·物联网·算法·嵌入式·iot平台·智能门锁
PineappleCoder1 小时前
👶 小孩报数问题:当熊孩子遇上“约瑟夫环
前端·算法
星火飞码iFlyCode1 小时前
真实案例 | 如何用iFlyCode开发Webpack插件?
java·python·编辑器
三只熊猫1 小时前
一文打通 AI 知识脉络:大语言模型等关键内容详解
人工智能·python
Kyln.Wu1 小时前
【python实用小脚本-187】Python一键批量改PDF文字:拖进来秒出新文件——再也不用Acrobat来回导
python·pdf·c#