【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

相关推荐
dinl_vin3 分钟前
python:常用的基础工具包
开发语言·python
2301_793804694 分钟前
C++中的适配器模式变体
开发语言·c++·算法
x_xbx6 分钟前
LeetCode:206. 反转链表
算法·leetcode·链表
abant29 分钟前
leetcode 138 复制随机链表
算法·leetcode·链表
wefly201721 分钟前
无需安装、开箱即用!m3u8live.cn 在线 HLS 播放器,调试直播流效率翻倍
前端·后端·python·前端开发工具·后端开发工具
ab15151729 分钟前
3.17二刷基础112 118 完成进阶52
数据结构·算法
美式请加冰35 分钟前
链表的介绍和使用
数据结构·链表
2301_8154829342 分钟前
用Python实现自动化的Web测试(Selenium)
jvm·数据库·python
将心ONE1 小时前
melo tts安装使用
python
旖-旎1 小时前
二分查找(1)
c++·算法·二分查找·力扣·双指针