【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

相关推荐
辣椒思密达16 小时前
Python公开数据采集实战:如何解决请求高频拦截与Session会话中断问题
开发语言·python
Albart57517 小时前
Python 实战教程:用 30 分钟学会解决真实问题
开发语言·python
2301_7736436217 小时前
ceph池
开发语言·ceph·python
梦梦代码精17 小时前
为什么这个开源的AI平台会火?有点东西。。。
人工智能·算法·机器学习·docker·开源
随意起个昵称17 小时前
线性dp-综合刷题1(Not Alone)
算法·动态规划
极客笔记Jack17 小时前
Scanpy AnnData 对象深度解析:高效操作数据结构的10个技巧
python
颜酱18 小时前
LangChain调用向量模型,存入向量数据库
python·langchain
2501_9289455218 小时前
七本性全面签名体系:从互递归类型到∞-范畴生成语法
python
Lyyaoo.18 小时前
【数据结构】HashMap底层存储+扩容机制+线程安全【待更新】
数据结构·安全·哈希算法
如何原谅奋力过但无声18 小时前
【灵神高频面试题合集09-13】二叉树、二叉搜索树
数据结构·算法·leetcode