From 34d837e5ed603f93a9774cda3b17474401cf41ef Mon Sep 17 00:00:00 2001 From: jin Date: Wed, 19 Oct 2022 21:29:05 +0900 Subject: [PATCH 1/2] 1019 --- .../11047.py" | 9 +++++++++ .../11399.py" | 7 +++++++ .../11576.py" | 12 +++++++++++ .../13305.py" | 20 +++++++++++++++++++ .../1541.py" | 20 +++++++++++++++++++ .../1931.py" | 14 +++++++++++++ .../2089.py" | 13 ++++++++++++ 7 files changed, 95 insertions(+) create mode 100644 "HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/11047.py" create mode 100644 "HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/11399.py" create mode 100644 "HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/11576.py" create mode 100644 "HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/13305.py" create mode 100644 "HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/1541.py" create mode 100644 "HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/1931.py" create mode 100644 "HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/2089.py" diff --git "a/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/11047.py" "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/11047.py" new file mode 100644 index 0000000..57a0a5e --- /dev/null +++ "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/11047.py" @@ -0,0 +1,9 @@ +a,b=map(int,input().split()) +array=[int(input()) for _ in range(a)] +array.sort(reverse=True) + +cnt=0 +for i in array: + cnt+=b//i + b=b%i +print(cnt) \ No newline at end of file diff --git "a/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/11399.py" "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/11399.py" new file mode 100644 index 0000000..a69fbc0 --- /dev/null +++ "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/11399.py" @@ -0,0 +1,7 @@ +n=int(input()) +li = list(map(int,input().split())) +li.sort() +rs=0 +for i in range(n): + rs+=li[i]*(n-i) +print(rs) \ No newline at end of file diff --git "a/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/11576.py" "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/11576.py" new file mode 100644 index 0000000..84959fe --- /dev/null +++ "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/11576.py" @@ -0,0 +1,12 @@ +a,b=map(int,input().split()) +n=int(input()) +numA=list(map(int,input().split())) +rs=0 +for i in range(n): + rs+=numA[n-i-1]*a**i +rs2=[] +while rs: + rs2.append(rs%b) + rs//=b +rs2.reverse() +print(*rs2) diff --git "a/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/13305.py" "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/13305.py" new file mode 100644 index 0000000..05abbf6 --- /dev/null +++ "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/13305.py" @@ -0,0 +1,20 @@ +n=int(input()) +dis=list(map(int,input().split())) +node=list(map(int,input().split())) + +node[-1]=1000000001 +dis.append(0) + +rs=dis[0]*node[0] +acc_dis=0 +minV=node[0] + +for i in range(1,n): + if minV<=node[i]: + acc_dis+=dis[i] + else: + rs+=acc_dis*minV + acc_dis=dis[i] + minV=node[i] +rs+=acc_dis*minV +print(rs) \ No newline at end of file diff --git "a/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/1541.py" "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/1541.py" new file mode 100644 index 0000000..4e04057 --- /dev/null +++ "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/1541.py" @@ -0,0 +1,20 @@ +inp = input() +op=[] +for i in inp: + if i=='+' or i=='-': + op.append(i) +inp=inp.replace('-','+') +num = list(map(int,inp.split('+'))) + +# print(op,num) +rs=num[0] +rs2=0 +flag=0 +for i in range(len(op)): + if op[i]=='+' and not rs2: + rs+=num[i+1] + else: + rs2+=num[i+1] +if rs2: + rs-=rs2 +print(rs) \ No newline at end of file diff --git "a/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/1931.py" "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/1931.py" new file mode 100644 index 0000000..33488f7 --- /dev/null +++ "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/1931.py" @@ -0,0 +1,14 @@ +n=int(input()) +li=[[0,0]] +for _ in range(n): + inp = list(map(int,input().split())) + li.append(inp) +li.sort(key=lambda x:(x[1],x[0])) +cnt=0 +maxV=0 +# print(li) +for i in range(1,len(li)): + if li[i][0]>=maxV: + maxV=li[i][1] + cnt+=1 +print(cnt) \ No newline at end of file diff --git "a/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/2089.py" "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/2089.py" new file mode 100644 index 0000000..1a37c18 --- /dev/null +++ "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/2089.py" @@ -0,0 +1,13 @@ +n=int(input()) +rs='' +if not n: + print(0) +else: + while n: + if n%-2: + rs='1'+rs + n=n//-2+1 + else: + rs='0'+rs + n//=-2 + print(''.join(rs)) \ No newline at end of file From 9f4f499e3f0e45c4b3e27d5aee3026c3c5a8f596 Mon Sep 17 00:00:00 2001 From: jin Date: Thu, 20 Oct 2022 00:26:15 +0900 Subject: [PATCH 2/2] 1020 --- .../15649.py" | 6 ++++++ .../15650.py" | 5 +++++ .../15651.py" | 5 +++++ .../15652.py" | 5 +++++ .../15654.py" | 7 +++++++ 5 files changed, 28 insertions(+) create mode 100644 "HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15649.py" create mode 100644 "HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15650.py" create mode 100644 "HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15651.py" create mode 100644 "HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15652.py" create mode 100644 "HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15654.py" diff --git "a/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15649.py" "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15649.py" new file mode 100644 index 0000000..d09e12b --- /dev/null +++ "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15649.py" @@ -0,0 +1,6 @@ +from itertools import permutations + +a,b=map(int,input().split()) +arr=list(range(1,a+1)) +for i in permutations(arr,b): + print(*i) \ No newline at end of file diff --git "a/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15650.py" "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15650.py" new file mode 100644 index 0000000..72b0fd0 --- /dev/null +++ "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15650.py" @@ -0,0 +1,5 @@ +from itertools import combinations +a,b=map(int,input().split()) +a2=list(range(1,a+1)) +for i in combinations(a2,b): + print(*i) \ No newline at end of file diff --git "a/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15651.py" "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15651.py" new file mode 100644 index 0000000..ec19505 --- /dev/null +++ "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15651.py" @@ -0,0 +1,5 @@ +from itertools import product +a,b=map(int,input().split()) +a2=list(range(1,a+1)) +for i in product(a2,repeat=b): + print(*i) \ No newline at end of file diff --git "a/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15652.py" "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15652.py" new file mode 100644 index 0000000..96998d3 --- /dev/null +++ "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15652.py" @@ -0,0 +1,5 @@ +from itertools import combinations_with_replacement +a,b=map(int,input().split()) +a2=list(range(1,a+1)) +for i in combinations_with_replacement(a2,b): + print(*i) \ No newline at end of file diff --git "a/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15654.py" "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15654.py" new file mode 100644 index 0000000..ce66c37 --- /dev/null +++ "b/HomeWork/jin/3.\352\267\270\353\246\254\353\224\224,\354\210\234\354\227\264,\354\241\260\355\225\251/15654.py" @@ -0,0 +1,7 @@ +from itertools import permutations + +a,b=map(int,input().split()) +li=list(map(int,input().split())) +li2=sorted(permutations(li, b)) +for i in li2: + print(*i) \ No newline at end of file