【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

相关推荐
Ulyanov27 分钟前
构建企业级雷达电子战仿真引擎的工程化基础 第一篇:CI/CD流水线与自动化测试体系
python·ci/cd·架构·系统仿真·雷达电子战仿真
米粒19 小时前
力扣算法刷题 Day 27
算法·leetcode·职场和发展
IAUTOMOBILE9 小时前
Python 流程控制与函数定义:从调试现场到工程实践
java·前端·python
Fuxiao___9 小时前
C 语言核心知识点讲义(循环 + 函数篇)
算法·c#
漫随流水10 小时前
c++编程:反转字符串(leetcode344)
数据结构·c++·算法
TT_441910 小时前
python程序实现图片截图溯源功能
开发语言·python
小陈的进阶之路11 小时前
logging 日志模块笔记
python
cqbelt11 小时前
Python 并发编程实战学习笔记
笔记·python·学习
穿条秋裤到处跑11 小时前
每日一道leetcode(2026.03.31):字典序最小的生成字符串
算法·leetcode
智算菩萨11 小时前
【论文复现】Applied Intelligence 2025:Auto-PU正例无标签学习的自动化实现与GPT-5.4辅助编程实战
论文阅读·python·gpt·学习·自动化·复现