【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

相关推荐
toolhow8 分钟前
SelfAttenion自注意力机制
pytorch·python·深度学习
智航GIS8 分钟前
6.2 while循环
java·前端·python
qq_3363139310 分钟前
java基础-IO流(转换流)
java·开发语言·python
mit6.82414 分钟前
右端点对齐|镜像复用
算法
Stestack19 分钟前
ssh批量机器免密操作
linux·python·ssh
a程序小傲22 分钟前
得物Java面试被问:反射机制的原理和应用场景
java·python·面试
于越海22 分钟前
学习小项目:用 Python 自动统计编程课绩点(5.0 制|百分制直算|重修取最高)
开发语言·笔记·python·学习·学习方法
xingzhemengyou127 分钟前
Python GUI中常用的after
开发语言·python
郝学胜-神的一滴39 分钟前
Python抽象基类与abc模块详解:优雅设计接口的利器
开发语言·python·程序人生
小南知更鸟1 小时前
前端静态项目快速启动:python -m http.server 4173 与 npx serve . 全解析
前端·python·http