【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

相关推荐
OPEN-F11 小时前
C++进阶教程:运算符重载与类型转换
java·c++·算法
圆圆讲门店11 小时前
实体获客团队|基础概念与核心要点整理
人工智能·python
牧杉-惊蛰11 小时前
将数组对象根据自定义排列
java·开发语言·算法
砚底藏山河11 小时前
【量化纯GET实战 #04】批量快照:一次 HTTP GET 取多只股票
java·python·金融·eclipse
inquisiter12 小时前
损失函数在标量和矩阵上的求导对比
线性代数·算法·矩阵
烂蜻蜓12 小时前
Flask入门教程(九):模板渲染——用Jinja2构建动态页面
后端·python·flask
2601_9668714012 小时前
AE影视后期特效-遮罩/调色/抠像/MG动画/3D/Vlog制作(完结)jzit
python
离凌寒12 小时前
一、关于st上制作外部烧录算法时软件识别不到算法文件的问题总结
算法
circuitsosk12 小时前
大模型本体安全防护实践:提示词注入防御、输出合规过滤与敏感信息脱敏
python·安全·数据脱敏·纵深防御·提示词注入·llmsecurity