【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

相关推荐
Thomas.Sir12 小时前
精通 MySQL 面试题
数据结构·数据库·mysql
阿钱真强道12 小时前
31 Python 聚类:层次聚类怎么理解?AGNES 和 DIANA 有什么区别?
python·聚类·层次聚类·diana·agnes
小王不爱笑13212 小时前
Java 泛型详解
java·windows·python
桃气媛媛12 小时前
python流程控制-匹配语句match
开发语言·python
阿Y加油吧12 小时前
力扣打卡——反转链表、回文链表判断 题解
算法·leetcode
羊小猪~~12 小时前
算法/力扣--数组典型题目
c语言·c++·python·算法·leetcode·职场和发展·求职招聘
Johnny.Cheung12 小时前
【德国技术面试】两道小算法题(求两数之和/解谜游戏)
算法·面试
龙文浩_12 小时前
【无标题】AI深层神经网络(多层全连接)+ ReLU 激活 的完整处理流程
人工智能·python·深度学习·神经网络·机器学习
x_xbx12 小时前
LeetCode:198. 打家劫舍
算法·leetcode·职场和发展
罗湖老棍子12 小时前
打鼹鼠_二维树状数组(信息学奥赛一本通- P1540)(二维树状数组模版题)
数据结构·算法·树状数组·二维树状数组