【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

相关推荐
神仙别闹13 小时前
基于Python实现英词语自动对齐系统
开发语言·python
老歌老听老掉牙13 小时前
圆柱端面四平面交线及其在yoz面投影的几何解析与 Python 实现
开发语言·python·平面
lisw0513 小时前
互联网上的数据结构可视化!
数据结构·信息可视化
我要见SA姐114 小时前
Chrome 扩展安全攻防实录:从权限滥用到供应链投毒
运维·人工智能·python·机器学习·自动化
2601_9628857214 小时前
给 backtrader 接 A 股数据:用 AlphaFeed 喂PandasData
python
YYYing.14 小时前
【Agent系列 (十一) 】上下文工程
人工智能·python·ai·agent·上下文工程
计算机毕业编程指导师14 小时前
基于深度学习的光伏组件红外图像缺陷识别系统设计与实现
人工智能·python·深度学习·目标检测·毕业设计·课程设计·光伏
前端精髓15 小时前
langchain 短期记忆(状态)动态运行时上下文
python·langchain
AiNightVision15 小时前
无人机夜视模块如何选择?——从参数指标到系统集成的完整选型指南
人工智能·算法·计算机视觉·车载系统·无人机·视频·智能硬件
最强小杰16 小时前
DeepSeek V4 Flash + Codex CLI 接入教程:原生 Responses API 适配,从配置到跑通收藏这篇就够了(2026)
java·前端·python·ai