【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

相关推荐
小许同学记录成长6 分钟前
基于幅度形态与参数聚类的工作模式判别
python·算法·scikit-learn
Languorous.11 分钟前
C++数据结构高阶|布隆过滤器(Bloom Filter)深度解析:从原理到手写实现,面试高频考点全覆盖
数据结构·c++·面试
dinglu1030DL12 分钟前
CSS Grid布局如何实现网格项目排序_使用order属性改变显示顺序
jvm·数据库·python
财经资讯数据_灵砚智能17 分钟前
基于全球经济类多源新闻的NLP情感分析与数据可视化(日间)2026年5月13日
大数据·人工智能·python·信息可视化·自然语言处理
gumichef17 分钟前
二叉树_堆
算法
m0_4708576417 分钟前
c++怎么利用C++17的filesystem--copy实现高效文件夹克隆【详解】
jvm·数据库·python
duke86926721418 分钟前
HTML怎么区分正文与广告_HTML aside与广告位语义【技巧】
jvm·数据库·python
咕噜咕噜啦啦21 分钟前
RTX5090配置DGL
pytorch·python·conda·pip
Liangwei Lin28 分钟前
LeetCode 70. 爬楼梯
算法
2401_8246976637 分钟前
如何实现SQL存储过程状态监控_编写实时运行监控仪表盘
jvm·数据库·python