【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

相关推荐
梦幻精灵_cq28 分钟前
Linux.date格式化标识“制作”极简台历 vs Python.datetime.strftime格式化“精美”日历牌(时间工具依情境选择也是一种“智慧)
linux·python
ASS-ASH41 分钟前
视觉语言大模型Qwen3-VL-8B-Instruct概述
人工智能·python·llm·多模态·qwen·视觉语言模型·vlm
Xy-unu42 分钟前
[LLM]AIM: Adaptive Inference of Multi-Modal LLMs via Token Merging and Pruning
论文阅读·人工智能·算法·机器学习·transformer·论文笔记·剪枝
Hcoco_me43 分钟前
算法选型 + 调参避坑指南
算法
Jul1en_1 小时前
【算法】分治-归并类题目
java·算法·leetcode·排序算法
kangk121 小时前
统计学基础之概率(生物信息方向)
人工智能·算法·机器学习
再__努力1点1 小时前
【77】积分图像:快速计算矩形区域和核心逻辑
开发语言·图像处理·人工智能·python·算法·计算机视觉
matlabgoodboy1 小时前
程序代做python代编程matlab代码设计plc深度学习java编写C++代写
python·深度学习·matlab
唯唯qwe-1 小时前
Day22: 贪心算法 | 区间问题,左/右端点排序
算法·贪心算法
Hcoco_me1 小时前
LLM(Large Language Model)系统学习路线清单
人工智能·算法·自然语言处理·数据挖掘·聚类