【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

相关推荐
Lenyiin1 分钟前
《 Linux 修炼全景指南: 八 》别再碎片化学习!掌控 Linux 开发工具链:gcc、g++、GDB、Bash、Python 与工程化实践
linux·python·bash·gdb·gcc·g++·lenyiin
hetao17338371 分钟前
2025-12-21~22 hetao1733837的刷题笔记
c++·笔记·算法
Swizard6 分钟前
告别“意大利面条”:FastAPI 生产级架构的最佳实践指南
python·fastapi
不惑_12 分钟前
通俗理解卷积神经网络
人工智能·windows·python·深度学习·机器学习
滴啦嘟啦哒20 分钟前
【机械臂】【总览】基于VLA结构的指令驱动式机械臂
python·ros2·vla
醒过来摸鱼30 分钟前
递归三种分类方法
算法
写代码的【黑咖啡】31 分钟前
深入理解 Python 中的函数
开发语言·python
梦帮科技32 分钟前
量子计算+AI:下一代智能的终极形态?(第一部分)
人工智能·python·神经网络·深度优先·量子计算·模拟退火算法
小兔崽子去哪了35 分钟前
机器学习 线性回归
后端·python·机器学习
山海青风38 分钟前
藏文TTS介绍:6 MMS 项目的多语言 TTS
人工智能·python·神经网络·音视频