【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

相关推荐
ballball~~8 小时前
ISP-CCM(Color Correction Matrix)
图像处理·数码相机·算法
Sunshine for you9 小时前
实时操作系统中的C++
开发语言·c++·算法
中科院提名者9 小时前
BPE 算法的硬核拆解——理解词表(Vocabulary)是如何从零训练出来的,以及字符串是如何被切碎的
算法
数据科学小丫9 小时前
Python 数据存储操作_数据存储、补充知识点:Python 与 MySQL交互
数据库·python·mysql
Knight_AL9 小时前
Nacos 启动问题 Failed to create database ’D:\nacos\nacos\data\derby-data’
开发语言·数据库·python
「QT(C++)开发工程师」9 小时前
C++11三大核心特性深度解析:类型特征、时间库与原子操作
java·c++·算法
乐分启航9 小时前
SliMamba:十余K参数量刷新SOTA!高光谱分类的“降维打击“来了
java·人工智能·深度学习·算法·机器学习·分类·数据挖掘
查古穆10 小时前
python进阶-Pydantic模型
开发语言·python
佳木逢钺11 小时前
PyQt界面美化系统高级工具库:打造现代化桌面应用的完整指南
python·pyqt
你真是饿了11 小时前
算法专题二:滑动窗口
算法