This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
def main(): | |
a, b, c, d = map(int,input().split()) | |
print(max(a*c,a*d,b*c,b*d)) | |
if __name__=='__main__': | |
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
def main(): | |
x = int(input()) | |
if x == 0: | |
print(1) | |
else: | |
print(0) | |
if __name__=='__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
from collections import deque | |
def main(): | |
n,m=map(int,input().split()) | |
graph=[[] for _ in range(n)] | |
for i in range(m): | |
a,b=map(int,input().split()) | |
graph[a-1].append(b-1) | |
graph[b-1].append(a-1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
import math | |
def main(): | |
a,b,h,m=map(int,input().split()) | |
theta_a=(60*h+m)*2*math.pi/720 | |
theta_b=m*2*math.pi/60 | |
print(math.sqrt((a*math.cos(theta_a)-b*math.cos(theta_b))**2+(a*math.sin(theta_a)-b*math.sin(theta_b))**2)) | |
if __name__=='__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
def main(): | |
k=int(input()) | |
s=input() | |
if len(s)<=k:print(s) | |
else: | |
print(s[:k]+"...") | |
if __name__=='__main__': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
def main(): | |
n=int(input()) | |
if n%10==2 or n%10==4 or n%10==5 or n%10==7 or n%10==9: | |
print("hon") | |
elif n%10==0 or n%10==1 or n%10==6 or n%10==8: | |
print("pon") | |
else: | |
print("bon") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
class mod_comb3: | |
def __init__(self,mod=10**9+7,n_max=1): | |
self.mod,self.n_max=mod,n_max | |
self.fact,self.inv,self.factinv=[1,1],[0,1],[1,1] | |
if 1<n_max:setup_table(n_max) | |
def comb(self,n,r): | |
if r<0 or n<r:return 0 | |
if self.n_max<n:self.setup_table(n) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
def main(): | |
n,k=map(int,input().split()) | |
A=list(map(int,input().split())) | |
if A[0]==1: | |
print(1) | |
sys.exit() | |
cur_a=1 | |
cunt=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
from itertools import product | |
def main(): | |
n,m,x=map(int,input().split()) | |
CA=[[int(_) for _ in input().split()] for i in range(n)] | |
ans=10**10 | |
n_lis=list(product([True,False],repeat=n)) | |
for comb in n_lis: | |
cunt=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def input(): return sys.stdin.readline().rstrip() | |
def main(): | |
a,b,_,k=map(int,input().split()) | |
if k<=a: | |
print(k) | |
elif k>a and k<=a+b: | |
print(a) | |
else: | |
print(a-(k-a-b)) |