Skip to content

Instantly share code, notes, and snippets.

Avatar

charter monhime

View GitHub Profile
@monhime
monhime / accum_string.cpp
Last active Jan 18, 2021
vector<string>を全結合
View accum_string.cpp
#include <iostream>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
int main(){
vector<string> A = {"I", "have", "a", "pen."};
@monhime
monhime / accum_pair.cpp
Last active Jan 18, 2021
pair型のベクタのfirst, secondそれぞれの和
View accum_pair.cpp
#include <iostream>
#include <vector>
#include <numeric>
using namespace std;
int main(){
vector<int> A = {1, 2, 3, 3, 2};
int sum = accumulate(A.begin(), A.end(), 0, [](int init, int v){ return init + v; });
cout << sum << "\n";
@monhime
monhime / ABC187_D.py
Created Jan 3, 2021
ABC187 D問題 解答
View ABC187_D.py
import sys
def input(): return sys.stdin.readline().rstrip()
from bisect import bisect_left,bisect
from itertools import accumulate
def main():
n = int(input())
AB = [tuple(map(int,input().split())) for i in range(n)]
C = [0]*n
sum_a = 0
for i, (a, b) in enumerate(AB):
@monhime
monhime / ABC187_C.py
Created Jan 3, 2021
ABC187 C問題解答
View ABC187_C.py
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n = int(input())
S = [input() for i in range(n)]
S.sort()
for i, s in enumerate(S):
if s[0] != '!':
idx_s2 = i
break
@monhime
monhime / ABC187_B.py
Created Jan 3, 2021
ABC187 B問題 解答
View ABC187_B.py
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
n = int(input())
XY = [[int(_) for _ in input().split()] for i in range(n)]
ans = 0
for i in range(n):
x_i = XY[i][0]
y_i = XY[i][1]
for j in range(i + 1, n):
@monhime
monhime / ABC187_A.py
Created Jan 3, 2021
ABC187 A問題 解答
View ABC187_A.py
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
a, b = input().split()
s_a = int(a[0]) + int(a[1]) + int(a[2])
s_b = int(b[0]) + int(b[1]) + int(b[2])
print(max(s_a, s_b))
if __name__=='__main__':
main()
@monhime
monhime / ALCBC_D.gyp
Created Sep 26, 2020
ALCDC D問題 解答
View ALCBC_D.gyp
import sys
def input(): return sys.stdin.readline().rstrip()
from fractions import gcd
class seg():
def __init__(self,init_val):
self.n=len(init_val)
self.ide_ele= 0 #単位元
self.num=2**(self.n-1).bit_length() #n以上の最小の2のべき乗
self.seg=[self.ide_ele]*2*self.num
for i in range(self.n):
View ALCBC_C.gyp
import sys
def input(): return sys.stdin.readline().rstrip()
class UnionFind():
def __init__(self, n):
self.n=n
self.parents=[-1]*n # 親(uf.find()で経路圧縮して根)の番号。根の場合は-(そのグループの要素数)
def find(self,x):
#グループの根を返す
if self.parents[x]<0:return x
else:
@monhime
monhime / ALCBC_B.gyp
Created Sep 26, 2020
ALCBC B問題解答
View ALCBC_B.gyp
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
a, b, c, d = map(int,input().split())
if max(a, c) <= min(b,d):
print("Yes")
else:
print("No")
if __name__=='__main__':
@monhime
monhime / ALCBC_A.gyp
Created Sep 26, 2020
ALCBC A問題 解答
View ALCBC_A.gyp
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
k = int(input())
ans = ""
for i in range(k):
ans += "ACL"
print(ans)
if __name__=='__main__':