【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

相关推荐
始三角龙几秒前
LeetCode hoot 100 -- 缺失的第一个正整数
算法·leetcode·职场和发展
飞Link15 分钟前
深度解析孪生网络(Siamese Network):从原理、技巧到实战应用
算法·数据挖掘·回归
结衣结衣.16 分钟前
走进机器学习:新手必看的完整入门指南
人工智能·python·学习·机器学习
绘梨衣54724 分钟前
某公开数据简单逆向
python·beautifulsoup
测试狗科研平台25 分钟前
洞悉微观电荷流动,VASP计算电荷密度分布
算法·云计算·开源软件
Sarvartha29 分钟前
单链表的顺序建立与结点的删除(期末题复现)
数据结构
Orz_Sponge_Bob1 小时前
温州市第三届青少年程序设计竞赛(小学组)题解
算法
小江的记录本1 小时前
【Java并发编程】锁机制:volatile:JMM内存模型、可见性/禁止指令重排、内存屏障、单例模式中的应用(附《思维导图》+《面试高频考点清单》)
java·后端·python·mysql·单例模式·面试·职场和发展
Noushiki1 小时前
常见的排序算法
算法·排序算法
csdn小瓯1 小时前
前端工程化:React + TypeScript + Tailwind CSS 的组件化实践
开发语言·人工智能·python