【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

相关推荐
Remember_9931 分钟前
【数据结构】深入理解排序算法:从基础原理到高级应用
java·开发语言·数据结构·算法·spring·leetcode·排序算法
bybitq2 分钟前
Leetcode-124-二叉树最大路径和-Python
算法·leetcode·深度优先
山川而川-R3 分钟前
windows系统安装labelimg按“W”键报错
python
袁袁袁袁满3 分钟前
OpenAI SDK集成亮数据网页解锁器实现自动化爬虫
爬虫·python·ai·网络爬虫·爬虫实战·自动化爬虫·ai爬虫
哈哈不让取名字4 分钟前
使用Fabric自动化你的部署流程
jvm·数据库·python
鱼跃鹰飞5 分钟前
Leetcode会员专享题:426.将二叉搜索树转换为排序的双向链表
数据结构·算法·leetcode·链表·深度优先
仰望星空@脚踏实地5 分钟前
Python 中subprocess.getstatusoutput(cmd) 函数注入命令风险分析
python·datakit·getstatusoutput
深蓝电商API6 分钟前
Scrapy 自定义命令与扩展:打造专属爬虫工具
爬虫·python·scrapy
漫随流水6 分钟前
leetcode回溯算法(39.组合总和)
数据结构·算法·leetcode·回溯算法
郝学胜-神的一滴6 分钟前
机器学习数据预处理:深入理解标准化与sklearn的StandardScaler
开发语言·人工智能·python·程序人生·机器学习·sklearn