【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

相关推荐
llilian_1612 小时前
铷原子频率标准 以时频基准破局,为计量校准赋能 时基铷钟
网络·功能测试·单片机·嵌入式硬件·测试工具·算法
AI效率工坊12 小时前
【Python实战】数据可视化自动化:matplotlib+pyecharts+AI智能推荐图表类型
python·信息可视化·自动化
6Hzlia13 小时前
【Hot 100 刷题计划】 LeetCode 131. 分割回文串 | C++ 回溯算法基础切割法
c++·算法·leetcode
User_芊芊君子13 小时前
2026 Python+AI入门|0基础速通,吃透热门轻量化玩法
开发语言·人工智能·python
美式请加冰13 小时前
子序列问题
数据结构·算法·leetcode
DeniuHe13 小时前
线性回归与逻辑回归:同为凸函数,为何一个有解析解、一个没有?
算法·机器学习·逻辑回归
好家伙VCC13 小时前
**发散创新:基于Python的自动化恢复演练框架设计与实战**在现代软件系统运维中,
java·开发语言·python·自动化
披着羊皮不是狼13 小时前
基于CNN的图像检测算法
人工智能·算法·cnn
程序员小崔日记13 小时前
我参加了第十七届蓝桥杯 Java B 组省赛,这套题你能撑到第几题?
java·算法·蓝桥杯大赛
爆更小哇13 小时前
Python自动化测试:pytest新手快速入门指南
python·测试工具·自动化·pytest