【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

相关推荐
Lisssaa几秒前
打卡第二十八天
数据结构·算法
2301_814590253 分钟前
使用Python进行图像识别:CNN卷积神经网络实战
jvm·数据库·python
小此方4 分钟前
算法实战论01(双指针篇一):双指针的核心思想与应用场景总结
c++·算法·力扣
第一程序员8 分钟前
GitHub Actions:Python项目的CI/CD实践
python·ci/cd·github
2401_878530218 分钟前
C++与FPGA协同设计
开发语言·c++·算法
2301_8145902510 分钟前
C++中的装饰器模式实战
开发语言·c++·算法
weixin_6495556717 分钟前
C语言程序设计第四版(何钦铭、颜晖)第十一章指针进阶之查找星期
数据结构·算法
北顾笙98021 分钟前
day10-数据结构力扣
数据结构
matlabgoodboy24 分钟前
Python代做java代码编写C++大数据R语言Hadoop/spark/flink/C语言
java·大数据·python