【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

相关推荐
量子物理学3 分钟前
三、C#高级进阶语法——特性(Attribute)
java·算法·c#
刘恒12345678913 分钟前
Windows 电脑文件夹手动分类指南
java·windows·python·电脑·php
测试渣16 分钟前
持续集成中的自动化测试框架优化实战指南
python·ci/cd·单元测试·自动化·pytest
忍者必须死24 分钟前
JDK1.7的HashMap的环形链表
java·数据结构·算法·链表
dzl8439424 分钟前
mac 安装python
开发语言·python·macos
NEXT0627 分钟前
数组转树与树转数组
前端·数据结构·面试
清水白石00828 分钟前
观察者模式全解析:用 Python 构建优雅的事件系统,让组件彻底解耦
java·python·观察者模式
仟濹29 分钟前
【算法打卡day10(2026-02-24 周二)动态规划DP基础理论】
算法·动态规划
xiaoccii34 分钟前
C++(入门版)
java·c++·算法
ADDDDDD_Trouvaille35 分钟前
2026.2.23——OJ101-103题
c++·算法