Skip to content

Instantly share code, notes, and snippets.

@monhime
monhime / ABC178E.gyp
Created Sep 13, 2020
ABC178 E問題 解答
View ABC178E.gyp
import sys
def input(): return sys.stdin.readline().rstrip()
from operator import itemgetter
def main():
n = int(input())
XY = [tuple(map(int,input().split())) for i in range(n)]
XY.sort()
ans = 0
SXY = [[0,0,0] for i in range(n)]
for i in range(n):
@monhime
monhime / ABC178D.gyp
Created Sep 13, 2020
ABC178 D問題 解答
View ABC178D.gyp
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)
@monhime
monhime / ABC178C.gyp
Created Sep 13, 2020
ABC178 C問題 解答
View ABC178C.gyp
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n = int(input())
mod = 10**9+7
print((pow(10,n,mod)-2*pow(9,n,mod)+pow(8,n,mod))%mod)
if __name__=='__main__':
main()
@monhime
monhime / ABC178B.gyp
Created Sep 13, 2020
ABC178 B問題 解答
View ABC178B.gyp
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()
@monhime
monhime / ABC178A.gyp
Created Sep 13, 2020
ABC178 A問題 解答
View ABC178A.gyp
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__':
@monhime
monhime / ABC168D.gyp
Created May 18, 2020
ABC168 D問題 解答
View ABC168D.gyp
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)
@monhime
monhime / ABC168C.gyp
Created May 18, 2020
ABC168 C問題 解答
View ABC168C.gyp
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__':
@monhime
monhime / ABC168B.gyp
Created May 18, 2020
ABC168 B問題 解答
View ABC168B.gyp
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__':
@monhime
monhime / ABC168A.gyp
Created May 17, 2020
ABC168 A問題 解答
View ABC168A.gyp
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")
@monhime
monhime / ABC167E.gyp
Last active May 11, 2020
ABC167 E問題 解答
View ABC167E.gyp
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)
You can’t perform that action at this time.