【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

相关推荐
立志成为大牛的小牛1 天前
数据结构——五十一、散列表的基本概念(王道408)
开发语言·数据结构·学习·程序人生·算法·散列表
杨福瑞1 天前
数据结构:双向链表(3)
c语言·数据结构·链表
Coovally AI模型快速验证1 天前
去噪扩散模型,根本不去噪?何恺明新论文回归「去噪」本质
人工智能·深度学习·算法·机器学习·计算机视觉·数据挖掘·回归
歌_顿1 天前
attention、transform、bert 复习总结 1
人工智能·算法
MicroTech20251 天前
MLGO微算法科技时空卷积与双重注意机制驱动的脑信号多任务分类算法
科技·算法·分类
txp玩Linux1 天前
rk3568上解析webrtc音频降噪算法处理流程
算法·音视频·webrtc
明知道的博客1 天前
解决WSL环境下DeepSeek-OCR运行时内存不足问题
python·ocr·deepseek·deepseek-ocr
立志成为大牛的小牛1 天前
数据结构——五十二、散列函数的构造(王道408)
数据结构·笔记·程序人生·考研·算法
FreeCode1 天前
LangGraph1.0智能体开发:Graph API概念与设计
python·langchain·agent
AAA阿giao1 天前
大厂面试之反转字符串:深入解析与实战演练
前端·javascript·数据结构·面试·职场和发展·编程技巧