【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

相关推荐
m0_734949797 小时前
MySQL如何配置定时清理过期备份文件_find命令与保留周期策略
jvm·数据库·python
m0_514520577 小时前
MySQL索引优化后性能没提升_通过EXPLAIN查看索引命中率
jvm·数据库·python
H Journey7 小时前
Python 国内pip install 安装缓慢
python·pip·install 加速
Sam_Deep_Thinking8 小时前
学数据结构到底有什么用
数据结构
kobesdu8 小时前
人形机器人SLAM:技术挑战、算法综述与开源方案
算法·机器人·人形机器人
Polar__Star9 小时前
如何在 AWS Lambda 中正确使用临时凭证生成 S3 预签名 URL
jvm·数据库·python
m0_743623929 小时前
React 自定义 Hook 的命名规范与调用规则详解
jvm·数据库·python
FreakStudio9 小时前
无硬件学LVGL—定时器篇:基于Web模拟器+MicroPython速通GUI开发
python·单片机·嵌入式·大学生·面向对象·并行计算·电子diy·电子计算机
椰羊~王小美10 小时前
随机数概念及算法
算法
阿Y加油吧10 小时前
算法实战笔记:LeetCode 169 多数元素 & 75 颜色分类
笔记·算法·leetcode