【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

相关推荐
Cloud_Shy61829 分钟前
Python 数据分析基础入门:《Excel Python:飞速搞定数据分析与处理》学习笔记系列(第八章 使用读写包操作 Excel 文件 上篇)
python·数据分析·excel·pandas
阿旭超级学得完41 分钟前
C++11包装器(function和bind)
java·开发语言·c++·算法·哈希算法·散列表
輕華41 分钟前
uv工具详解——Python包与项目管理器完全指南
开发语言·python·uv
li星野42 分钟前
位运算 & 数学 & 高频进阶九题通关(Python + C++)
c++·python·学习·算法
用户8356290780511 小时前
使用 Python 在 PowerPoint 中添加并控制音频播放
后端·python
jerryinwuhan1 小时前
hello算法,简单讲(1)
算法·排序算法
y = xⁿ1 小时前
20天速通LeetCodeday15:BFS广度优先搜索
算法·宽度优先
2303_821287381 小时前
如何清洗SQL输入数据_使用框架内置的ORM处理数据交互
jvm·数据库·python
400分1 小时前
吃透RAG核心-----语义检索与关键字检索底层原理
算法·架构
go不是csgo1 小时前
s01 搭建第一个对话智能体
服务器·网络·python·ai