【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

相关推荐
汀、人工智能3 分钟前
[特殊字符] 第26课:环形链表
数据结构·算法·链表·数据库架构··环形链表
smj2302_796826523 分钟前
解决leetcode第3883题统计满足数位和数组的非递减数组数目
python·算法·leetcode
小比特_蓝光5 分钟前
算法篇二----二分查找
java·数据结构·算法
李昊哲小课7 分钟前
Python办公自动化教程 - openpyxl让Excel处理变得轻松
python·信息可视化·excel
Ulyanov8 分钟前
Streamlit基础入门与快速原型开发
python·架构·系统仿真
田梓燊21 分钟前
leetcode 56
java·算法·leetcode
源码之屋24 分钟前
计算机毕业设计:Python出行数据智能分析与预测平台 Django框架 可视化 数据分析 PyEcharts 交通 深度学习(建议收藏)✅
人工智能·python·深度学习·数据分析·django·汽车·课程设计
2301_8035545226 分钟前
三大编程语言(Python/Go/C++)项目启动全解析
c++·python·golang
给自己做减法36 分钟前
AI编程相关概念
人工智能·python·ai编程
仍然.43 分钟前
多线程---阻塞队列收尾和线程池
java·开发语言·算法