当前位置: 代码网 > it编程>软件设计>算法 > 【CodinGame】趣味算法 CLASH OF CODE - 20240724

【CodinGame】趣味算法 CLASH OF CODE - 20240724

2024年08月03日 算法 我要评论
eval不安全,看情况使用。

在这里插入图片描述
在这里插入图片描述

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!")



在这里插入图片描述

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)



在这里插入图片描述
在这里插入图片描述

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)




在这里插入图片描述

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

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2025  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com