【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

相关推荐
数智工坊几秒前
【数据结构-查找】7.1顺序查找-折半查找-分块查找
数据结构
凤年徐2 分钟前
容器适配器深度解析:从STL的stack、queue到优先队列的底层实现
开发语言·c++·算法
乐迪信息2 分钟前
乐迪信息:AI防爆摄像机的船舶船体烟火智能预警系统
大数据·网络·人工智能·算法·无人机
蓝海星梦4 分钟前
GRPO 算法演进——偏差修正/鲁棒优化/架构扩展篇
论文阅读·人工智能·深度学习·算法·自然语言处理·强化学习
后来后来啊9 分钟前
2026.2.2 & 2.3学习笔记
数据结构·笔记·学习·算法·leetcode
li三河9 分钟前
yolo进行剪枝、蒸馏、量化研究
算法·yolo·剪枝
Emberone13 分钟前
数据结构:算法的时间复杂度和空间复杂度
数据结构·算法
历程里程碑17 分钟前
Linux 18 进程控制
linux·运维·服务器·开发语言·数据结构·c++·笔记
七夜zippoe21 分钟前
Dask:超越内存限制的并行计算——从任务图到分布式调度的实战指南
python·集群·task·array·dataframe·dask
YuTaoShao21 分钟前
【LeetCode 每日一题】3013. 将数组分成最小总代价的子数组 II
算法·leetcode·职场和发展