【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

相关推荐
北顾笙9808 分钟前
day15-数据结构力扣
数据结构·算法·leetcode
Ulyanov27 分钟前
卡尔曼滤波技术博客系列:第四篇:多目标跟踪:数据关联与航迹管理
python·目标跟踪·系统仿真·雷达电子战·仿真引擎
AI成长日志28 分钟前
【GitHub开源项目专栏】黑客松项目架构模式解析:微服务、事件驱动与Serverless实战
算法
人道领域28 分钟前
【LeetCode刷题日记:24】两两交换链表
算法·leetcode·链表
北顾笙98031 分钟前
day16-数据结构力扣
数据结构·算法·leetcode
Three~stone37 分钟前
MATLAB vs Python 两者区别和安装教程
开发语言·python·matlab
AI成长日志43 分钟前
【算法学习专栏】动态规划基础·简单三题精讲(70.爬楼梯、118.杨辉三角、121.买卖股票的最佳时机)
学习·算法·动态规划
wsoz1 小时前
Leetcode子串-day4
c++·算法·leetcode
soragui1 小时前
【Python】第 1 章:Python 解释器原理
开发语言·python
Ulyanov1 小时前
卡尔曼滤波技术博客系列:第三篇 雷达目标跟踪:运动模型与坐标转换
python·目标跟踪·系统仿真·雷达电子战