【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

相关推荐
37.2℃9958 分钟前
Claude Design哪个公司技术好
python·设计模式
Warren2Lynch11 分钟前
掌握 UML 构造型、标记定义与标记值:面向领域特定建模的 UML 扩展全面指南
大数据·算法·uml
1570925113440 分钟前
【无标题】
开发语言·python·算法
稚南城才子,乌衣巷风流1 小时前
换根法(Rerooting)算法详解
算法
晓子文集1 小时前
Tushare接口文档:期货交易日历(fut_trade_cal)
大数据·算法
AI工具人PM产品经理1 小时前
CSDN 自动发布全流程实战:从 CKEditor HTML 注入到创作页就地发布
python
_Jimmy_1 小时前
Tool Calling 与 Function Calling 区别
人工智能·python·langchain
逆风飞翔的小叔1 小时前
【Python基础】Python 流程控制语句使用详解
python·python 流程控制语句·python 流程控制·python 流程控制语句使用·python 流程控制语句详解
2601_963870221 小时前
基于Python的晋江文学城热门作品数据分析与可视化
开发语言·python·数据分析
llwszx1 小时前
【Java/Go后端手撸原生Agent(第七篇):Token预算管理 + 滑动窗口上下文裁剪】
java·后端·python·agent开发·上下文工程·上下文裁剪·滑动窗口裁剪