2019-11-15: init
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
.idea/
|
||||||
|
output/
|
||||||
0
PCC/stdin.txt
Normal file
0
PCC/stdin.txt
Normal file
30
README.md
Normal file
30
README.md
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
yenru0 code storage
|
||||||
|
===
|
||||||
|
## 기본 사항
|
||||||
|
|
||||||
|
`zeta`는 BOJ입니다.
|
||||||
|
|
||||||
|
`codeup`은 코드업입니다.
|
||||||
|
|
||||||
|
`PCC`는 *킹서노*썜이 주신 책에서 영감을 받거나 베낀것입니다.
|
||||||
|
|
||||||
|
이 뒤에 오는 것들은 작성 언어입니다. 다음은 현재까지 작성된 언어의 예시입니다. (C는 있었는데 지워버림;;)
|
||||||
|
|
||||||
|
작성언어 | 파일 뒤 | 확장자
|
||||||
|
:---:|:---:|:---:
|
||||||
|
C | C | .c
|
||||||
|
Python | python | .py
|
||||||
|
|
||||||
|
## stdin.txt
|
||||||
|
코딩의 편리함을 위한 `stdin.txt`! 이것은 매우 중요 especially 쓰다 C로 because 나 not 편함
|
||||||
|
|
||||||
|
## completed
|
||||||
|
내가 **납득**되거나 내가 해결한 문제는 `/completed`로 이동됩니다. __관짝__
|
||||||
|
|
||||||
|
ㄹㅇ 내가 못 품이 지속되거나 혹은 난제같은 것은 `/incomplete`로 이동됩니다.
|
||||||
|
다만, 그냥 내가 관심을 안줘서 해결되지 않은 문제는 `/`에 있을 예정입니다.
|
||||||
|
|
||||||
|
## 솔직히 이거...
|
||||||
|
다양한 곳에서의 편리한 코딩 생활을 위한 것입니다.
|
||||||
|
|
||||||
|
네.
|
||||||
0
codeup_C/stdin.txt
Normal file
0
codeup_C/stdin.txt
Normal file
0
codeup_python/stdin.txt
Normal file
0
codeup_python/stdin.txt
Normal file
36
zeta_python/1074.py
Normal file
36
zeta_python/1074.py
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
Size, r, c = map(int, input().split())
|
||||||
|
count = -1
|
||||||
|
|
||||||
|
def Z(X: int, Y: int, size: int):
|
||||||
|
global count, r, c
|
||||||
|
if size == 0:
|
||||||
|
count += 1
|
||||||
|
if X == c and Y == r:
|
||||||
|
print(count)
|
||||||
|
exit()
|
||||||
|
else:
|
||||||
|
p = 2**(size-1)
|
||||||
|
Z(X, Y, size-1)
|
||||||
|
Z(X+p, Y, size-1)
|
||||||
|
Z(X, Y+p, size-1)
|
||||||
|
Z(X+p, Y+p, size-1)
|
||||||
|
|
||||||
|
Z(0,0,Size)
|
||||||
|
'''
|
||||||
|
Z(0,0,2)
|
||||||
|
Z(0,0,1)
|
||||||
|
Z(0,0,0) each count() if size = 0
|
||||||
|
Z(1,0,0)
|
||||||
|
Z(0,1,0)
|
||||||
|
Z(1,1,0)
|
||||||
|
Z(2,0,1)
|
||||||
|
Z(2,0,0)
|
||||||
|
Z(3,0,0)
|
||||||
|
Z(2,1,0)
|
||||||
|
Z(3,1,0)
|
||||||
|
Z(0,2,1)
|
||||||
|
Z(2,2,1)
|
||||||
|
Z(1*2^2,0,2)
|
||||||
|
Z(1*2^2, 0, 1)
|
||||||
|
Z(2^2 + 1*2^0)
|
||||||
|
'''
|
||||||
26
zeta_python/1111.py
Normal file
26
zeta_python/1111.py
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
"""
|
||||||
|
1111: IQ Test
|
||||||
|
문제:
|
||||||
|
IQ Test의 문제 중에는 공통된 패턴을 찾는 문제가 있다. 수열이 주어졌을 때, 다음 수를 찾는 문제이다.
|
||||||
|
예를 들어, 1, 2, 3, 4, 5가 주어졌다. 다음 수는 무엇인가? 당연히 답은 6이다.
|
||||||
|
약간 더 어려운 문제를 보면, 3, 6, 12, 24, 48이 주어졌을 때, 다음 수는 무엇인가? 역시 답은 96이다.
|
||||||
|
|
||||||
|
이제 제일 어려운 문제를 보자.
|
||||||
|
1, 4, 13, 40이 주어졌을 때, 다음 수는 무엇일까? 답은 121이다.
|
||||||
|
그 이유는 항상 다음 수는 앞 수*3+1이기 때문이다.
|
||||||
|
은진이는 위의 3문제를 모두 풀지 못했으므로, 자동으로 풀어주는 프로그램을 작성하기로 했다.
|
||||||
|
항상 모든 답은 구하는 규칙은 앞 수*a + b이다. 그리고, a와 b는 정수이다.
|
||||||
|
수 N개가 주어졌을 때, 규칙에 맞는 다음 수를 구하는 프로그램을 작성하시오.
|
||||||
|
입력:
|
||||||
|
첫째 줄에 N이 주어진다. N은 50보다 작거나 같은 자연수이다. 둘째 줄에는 N개의 수가 주어진다. 이 수는 모두 절댓값이 100보다 작거나 같은 정수이다.
|
||||||
|
출력:
|
||||||
|
다음 수를 출력한다. 만약 다음 수가 여러 개일 경우에는 A를 출력하고, 다음 수를 구할 수 없는 경우에는 B를 출력한다.
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
TC1:
|
||||||
|
Input:
|
||||||
|
4
|
||||||
|
1 4 13 40
|
||||||
|
Output:
|
||||||
|
121
|
||||||
|
"""
|
||||||
34
zeta_python/11650.py
Normal file
34
zeta_python/11650.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
"""
|
||||||
|
11650: 좌표 정렬하기
|
||||||
|
문제:
|
||||||
|
2차원 평면 위의 점 N개가 주어진다.
|
||||||
|
좌표를 x좌표가 증가하는 순으로, x좌표가 같으면 y좌표가 증가하는 순서로 정렬한 다음 출력하는 프로그램을 작성하시오.
|
||||||
|
입력:
|
||||||
|
첫째 줄에 점의 개수 N (1 ≤ N ≤ 100,000)이 주어진다.
|
||||||
|
둘째 줄부터 N개의 줄에는 i번점의 위치 xi와 yi가 주어진다.(-100,000 ≤ xi, yi ≤ 100,000)
|
||||||
|
좌표는 항상 정수이고, 위치가 같은 두 점은 없다.
|
||||||
|
출력:
|
||||||
|
첫째 줄부터 N개의 줄에 점을 정렬한 결과를 출력한다.
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
TC1:
|
||||||
|
```
|
||||||
|
Input:
|
||||||
|
5
|
||||||
|
3 4
|
||||||
|
1 1
|
||||||
|
1 -1
|
||||||
|
2 2
|
||||||
|
3 3
|
||||||
|
Output:
|
||||||
|
1 -1
|
||||||
|
1 1
|
||||||
|
2 2
|
||||||
|
3 3
|
||||||
|
3 4
|
||||||
|
```
|
||||||
|
"""
|
||||||
|
N = int(input()); R = []
|
||||||
|
for i in sorted([input().split()for i in range(N)]):
|
||||||
|
R.append(' '.join(i))
|
||||||
|
print('\n'.join(R), end='')
|
||||||
27
zeta_python/1193.py
Normal file
27
zeta_python/1193.py
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
"""
|
||||||
|
1193: 분수찾기
|
||||||
|
문제:
|
||||||
|
무한히 큰 배열에 다음과 같은 분수들이 적혀 있다.
|
||||||
|
|
||||||
|
1/1 1/2 1/3 1/4 1/5 …
|
||||||
|
2/1 2/2 2/3 2/4 … …
|
||||||
|
3/1 3/2 3/3 … … …
|
||||||
|
4/1 4/2 … … … …
|
||||||
|
5/1 … … … … …
|
||||||
|
… … … … … …
|
||||||
|
|
||||||
|
이와 같이 나열된 분수들을 1/1 -> 1/2 -> 2/1 -> 3/1 -> 2/2 -> … 과 같은 지그재그 순서로 차례대로 1번, 2번, 3번, 4번, 5번, … 분수라고 하자.
|
||||||
|
|
||||||
|
X가 주어졌을 때, X번째 분수를 구하는 프로그램을 작성하시오.
|
||||||
|
입력:
|
||||||
|
첫째 줄에 X(1 ≤ X ≤ 10,000,000)가 주어진다.
|
||||||
|
출력:
|
||||||
|
첫째 줄에 분수를 출력한다.
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
TC1:
|
||||||
|
Input:
|
||||||
|
14
|
||||||
|
Output:
|
||||||
|
2/4
|
||||||
|
"""
|
||||||
71
zeta_python/15649.py
Normal file
71
zeta_python/15649.py
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
"""
|
||||||
|
15649: N과 M (1)
|
||||||
|
문제:
|
||||||
|
자연수 N과 M이 주어졌을 때 아래 조건을 만족하는 길이가 M인 수열을 모두 구하는 프로그램을 작성하시오.
|
||||||
|
- 1부터 N까지 자연수 중에서 중복 없이 M개 고른 수열
|
||||||
|
입력:
|
||||||
|
첫째 줄에 자연수 N과 M이 주어진다.
|
||||||
|
출력:
|
||||||
|
한 줄에 하나씩 문제의 조건을 만족하는 수열을 출력한다.
|
||||||
|
중복되는 수열을 여러 번 출력하면 안되며, 각 수열은 공백으로 구분해서 출력해야 한다.
|
||||||
|
수열은 사전 순으로 증가하는 순서로 출력해야 한다.
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
TC1:
|
||||||
|
```
|
||||||
|
Input:
|
||||||
|
3 1
|
||||||
|
Output:
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
```
|
||||||
|
TC2:
|
||||||
|
```
|
||||||
|
Input:
|
||||||
|
4 2
|
||||||
|
Output:
|
||||||
|
1 2
|
||||||
|
1 3
|
||||||
|
1 4
|
||||||
|
2 1
|
||||||
|
2 3
|
||||||
|
2 4
|
||||||
|
3 1
|
||||||
|
3 2
|
||||||
|
3 4
|
||||||
|
4 1
|
||||||
|
4 2
|
||||||
|
4 3
|
||||||
|
```
|
||||||
|
TC3:
|
||||||
|
```
|
||||||
|
Input:
|
||||||
|
4 4
|
||||||
|
Output:
|
||||||
|
1 2 3 4
|
||||||
|
1 2 4 3
|
||||||
|
1 3 2 4
|
||||||
|
1 3 4 2
|
||||||
|
1 4 2 3
|
||||||
|
1 4 3 2
|
||||||
|
2 1 3 4
|
||||||
|
2 1 4 3
|
||||||
|
2 3 1 4
|
||||||
|
2 3 4 1
|
||||||
|
2 4 1 3
|
||||||
|
2 4 3 1
|
||||||
|
3 1 2 4
|
||||||
|
3 1 4 2
|
||||||
|
3 2 1 4
|
||||||
|
3 2 4 1
|
||||||
|
3 4 1 2
|
||||||
|
3 4 2 1
|
||||||
|
4 1 2 3
|
||||||
|
4 1 3 2
|
||||||
|
4 2 1 3
|
||||||
|
4 2 3 1
|
||||||
|
4 3 1 2
|
||||||
|
4 3 2 1
|
||||||
|
```
|
||||||
|
"""
|
||||||
94
zeta_python/1874.py
Normal file
94
zeta_python/1874.py
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
"""
|
||||||
|
1874: 스택 수열
|
||||||
|
문제:
|
||||||
|
스택 (stack)은 기본적인 자료구조 중 하나로, 컴퓨터 프로그램을 작성할 때 자주 이용되는 개념이다.
|
||||||
|
스택은 자료를 넣는 (push) 입구와 자료를 뽑는 (pop) 입구가 같아 제일 나중에 들어간 자료가 제일 먼저 나오는 (LIFO, Last in First out) 특성을 가지고 있다.
|
||||||
|
|
||||||
|
1부터 n까지의 수를 스택에 넣었다가 뽑아 늘어놓음으로써, 하나의 수열을 만들 수 있다.
|
||||||
|
이때, 스택에 push하는 순서는 반드시 오름차순을 지키도록 한다고 하자.
|
||||||
|
임의의 수열이 주어졌을 때 스택을 이용해 그 수열을 만들 수 있는지 없는지, 있다면 어떤 순서로 push와 pop 연산을 수행해야 하는지를 알아낼 수 있다.
|
||||||
|
이를 계산하는 프로그램을 작성하라.
|
||||||
|
입력:
|
||||||
|
첫 줄에 n (1 ≤ n ≤ 100,000)이 주어진다.
|
||||||
|
둘째 줄부터 n개의 줄에는 수열을 이루는 1이상 n이하의 정수가 하나씩 순서대로 주어진다. 물론 같은 정수가 두 번 나오는 일은 없다.
|
||||||
|
|
||||||
|
출력:
|
||||||
|
입력된 수열을 만들기 위해 필요한 연산을 한 줄에 한 개씩 출력한다.
|
||||||
|
push연산은 +로, pop 연산은 -로 표현하도록 한다. 불가능한 경우 NO를 출력한다.
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
TC1:
|
||||||
|
```
|
||||||
|
Input:
|
||||||
|
8
|
||||||
|
4
|
||||||
|
3
|
||||||
|
6
|
||||||
|
8
|
||||||
|
7
|
||||||
|
5
|
||||||
|
2
|
||||||
|
1
|
||||||
|
Output:
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+
|
||||||
|
-
|
||||||
|
-
|
||||||
|
+
|
||||||
|
+
|
||||||
|
-
|
||||||
|
+
|
||||||
|
+
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-
|
||||||
|
```
|
||||||
|
TC2:
|
||||||
|
```
|
||||||
|
Input:
|
||||||
|
5
|
||||||
|
1
|
||||||
|
2
|
||||||
|
5
|
||||||
|
3
|
||||||
|
4
|
||||||
|
Output:
|
||||||
|
NO
|
||||||
|
```
|
||||||
|
"""
|
||||||
|
n = int(input())
|
||||||
|
que = list(range(n,0,-1))
|
||||||
|
|
||||||
|
stack = list()
|
||||||
|
|
||||||
|
def pop():
|
||||||
|
global stack
|
||||||
|
global que
|
||||||
|
|
||||||
|
poped = stack.pop()
|
||||||
|
que.insert(0,poped)
|
||||||
|
|
||||||
|
def push():
|
||||||
|
global stack
|
||||||
|
global que
|
||||||
|
|
||||||
|
pushed = que.pop()
|
||||||
|
stack.append(pushed)
|
||||||
|
|
||||||
|
|
||||||
|
while True:
|
||||||
|
a = input()
|
||||||
|
if a == 'push':
|
||||||
|
push()
|
||||||
|
elif a == 'pop':
|
||||||
|
pop()
|
||||||
|
elif a == 'que':
|
||||||
|
print(que)
|
||||||
|
elif a == 'stack':
|
||||||
|
print(stack)
|
||||||
|
else:
|
||||||
|
continue
|
||||||
51
zeta_python/2447.py
Normal file
51
zeta_python/2447.py
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
"""
|
||||||
|
2447: 별 찍기 - 10
|
||||||
|
문제:
|
||||||
|
예제를 보고 규칙을 유추한 뒤에 별을 찍어 보세요.
|
||||||
|
입력:
|
||||||
|
첫째 줄에 N이 주어진다. N은 항상 3의 제곱꼴인 수이다. (3, 9, 27, ...) (N=3^k, 1 ≤ k < 8)
|
||||||
|
출력:
|
||||||
|
첫째 줄부터 N번째 줄까지 별을 출력한다.
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
TC1:
|
||||||
|
Input:
|
||||||
|
27
|
||||||
|
Output:
|
||||||
|
***************************
|
||||||
|
* ** ** ** ** ** ** ** ** *
|
||||||
|
***************************
|
||||||
|
*** ****** ****** ***
|
||||||
|
* * * ** * * ** * * *
|
||||||
|
*** ****** ****** ***
|
||||||
|
***************************
|
||||||
|
* ** ** ** ** ** ** ** ** *
|
||||||
|
***************************
|
||||||
|
********* *********
|
||||||
|
* ** ** * * ** ** *
|
||||||
|
********* *********
|
||||||
|
*** *** *** ***
|
||||||
|
* * * * * * * *
|
||||||
|
*** *** *** ***
|
||||||
|
********* *********
|
||||||
|
* ** ** * * ** ** *
|
||||||
|
********* *********
|
||||||
|
***************************
|
||||||
|
* ** ** ** ** ** ** ** ** *
|
||||||
|
***************************
|
||||||
|
*** ****** ****** ***
|
||||||
|
* * * ** * * ** * * *
|
||||||
|
*** ****** ****** ***
|
||||||
|
***************************
|
||||||
|
* ** ** ** ** ** ** ** ** *
|
||||||
|
***************************
|
||||||
|
"""
|
||||||
|
s = []
|
||||||
|
def B(n):
|
||||||
|
if n == 1:
|
||||||
|
return "*"
|
||||||
|
else :
|
||||||
|
s.append([B(int(n/3))+B(int(n/3))+B(int(n/3))
|
||||||
|
B(int(n/3))+" "*int(n/3)+B(int(n/3))
|
||||||
|
B(int(n/3))+B(int(n/3)),B(int(n/3))
|
||||||
|
B(3)
|
||||||
64
zeta_python/2448.py
Normal file
64
zeta_python/2448.py
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
"""
|
||||||
|
2448: 별 찍기 - 11
|
||||||
|
문제:
|
||||||
|
예제를 보고 규칙을 유추한 뒤에 별을 찍어 보세요.
|
||||||
|
입력:
|
||||||
|
첫째 줄에 N이 주어진다. N은 항상 3×2^k 수이다. (3, 6, 12, 24, 48, ...) (k ≤ 10)
|
||||||
|
출력:
|
||||||
|
첫째 줄부터 N번째 줄까지 별을 출력한다.
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
TC1:
|
||||||
|
Input:
|
||||||
|
24
|
||||||
|
Output:
|
||||||
|
*
|
||||||
|
* *
|
||||||
|
*****
|
||||||
|
* *
|
||||||
|
* * * *
|
||||||
|
***** *****
|
||||||
|
* *
|
||||||
|
* * * *
|
||||||
|
***** *****
|
||||||
|
* * * *
|
||||||
|
* * * * * * * *
|
||||||
|
***** ***** ***** *****
|
||||||
|
* *
|
||||||
|
* * * *
|
||||||
|
***** *****
|
||||||
|
* * * *
|
||||||
|
* * * * * * * *
|
||||||
|
***** ***** ***** *****
|
||||||
|
* * * *
|
||||||
|
* * * * * * * *
|
||||||
|
***** ***** ***** *****
|
||||||
|
* * * * * * * *
|
||||||
|
* * * * * * * * * * * * * * * *
|
||||||
|
***** ***** ***** ***** ***** ***** ***** *****
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
s = [" * ", " * * ", "***** "]
|
||||||
|
|
||||||
|
|
||||||
|
def makestar(shift):
|
||||||
|
global s
|
||||||
|
c = len(s)
|
||||||
|
for i in range(c):
|
||||||
|
s.append(s[i] + s[i]) # 현 단계 삼각형을 뒤에 붙이고
|
||||||
|
print(s)
|
||||||
|
s[i] = (" " * shift + s[i] + " " * shift) # 현 단계 삼각형을 오른쪽으로 민다
|
||||||
|
print(s)
|
||||||
|
|
||||||
|
|
||||||
|
n = int(input())
|
||||||
|
k= n//6
|
||||||
|
for i in range(k):
|
||||||
|
print(int(pow(2,i)))
|
||||||
|
makestar(int(pow(2, i)))
|
||||||
|
|
||||||
|
for i in range(n):
|
||||||
|
print(s[i])
|
||||||
|
print(s)
|
||||||
|
print(k)
|
||||||
40
zeta_python/2504.py
Normal file
40
zeta_python/2504.py
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
"""
|
||||||
|
2504: 괄호의 값
|
||||||
|
문제:
|
||||||
|
4개의 기호 ‘(’, ‘)’, ‘[’, ‘]’를 이용해서 만들어지는 괄호열 중에서 올바른 괄호열이란 다음과 같이 정의된다.
|
||||||
|
|
||||||
|
1. 한 쌍의 괄호로만 이루어진 ‘()’와 ‘[]’는 올바른 괄호열이다.
|
||||||
|
2. 만일 X가 올바른 괄호열이면 ‘(X)’이나 ‘[X]’도 모두 올바른 괄호열이 된다.
|
||||||
|
3. X와 Y 모두 올바른 괄호열이라면 이들을 결합한 XY도 올바른 괄호열이 된다.
|
||||||
|
|
||||||
|
예를 들어 ‘(()[[]])’나 ‘(())[][]’ 는 올바른 괄호열이지만 ‘([)]’ 나 ‘(()()[]’ 은 모두 올바른 괄호열이 아니다.
|
||||||
|
우리는 어떤 올바른 괄호열 X에 대하여 그 괄호열의 값(괄호값)을 아래와 같이 정의하고 값(X)로 표시한다.
|
||||||
|
|
||||||
|
1. ‘()’ 인 괄호열의 값은 2이다.
|
||||||
|
2. ‘[]’ 인 괄호열의 값은 3이다.
|
||||||
|
3. ‘(X)’ 의 괄호값은 2×값(X) 으로 계산된다.
|
||||||
|
4. ‘[X]’ 의 괄호값은 3×값(X) 으로 계산된다.
|
||||||
|
5. 올바른 괄호열 X와 Y가 결합된 XY의 괄호값은 값(XY)= 값(X)+값(Y) 로 계산된다.
|
||||||
|
|
||||||
|
예를 들어 ‘(()[[]])([])’ 의 괄호값을 구해보자. ‘()[[]]’ 의 괄호값이 2 + 3×3=11 이므로 ‘(()[[ ]])’의 괄호값은 2×11=22 이다.
|
||||||
|
그리고 ‘([])’의 값은 2×3=6 이므로 전체 괄호열의 값은 22 + 6 = 28 이다.
|
||||||
|
|
||||||
|
여러분이 풀어야 할 문제는 주어진 괄호열을 읽고 그 괄호값을 앞에서 정의한대로 계산하여 출력하는 것이다.
|
||||||
|
입력:
|
||||||
|
첫째 줄에 괄호열을 나타내는 문자열(스트링)이 주어진다. 단 그 길이는 1 이상, 30 이하이다.
|
||||||
|
|
||||||
|
출력:
|
||||||
|
첫째 줄에 그 괄호열의 값을 나타내는 정수를 출력한다. 만일 입력이 올바르지 못한 괄호열이면 반드시 0을 출력해야 한다.
|
||||||
|
"""
|
||||||
|
"""
|
||||||
|
TC1:
|
||||||
|
Input:
|
||||||
|
(()[[]])([])
|
||||||
|
Output:
|
||||||
|
28
|
||||||
|
"""
|
||||||
|
import re
|
||||||
|
Input = input()
|
||||||
|
par_regex = re.compile(r'\((.*?)\)')
|
||||||
|
t = par_regex.search(Input)
|
||||||
|
print(t.groups())
|
||||||
4
zeta_python/completed/10171.py
Normal file
4
zeta_python/completed/10171.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
print("""\ /\\
|
||||||
|
) ( ')
|
||||||
|
( / )
|
||||||
|
\(__)|""")
|
||||||
9
zeta_python/completed/10809.py
Normal file
9
zeta_python/completed/10809.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from sys import *
|
||||||
|
c=0
|
||||||
|
D=[]
|
||||||
|
I=[ord(i)-97 for i in stdin.readline().rstrip()]
|
||||||
|
for i in range(26):
|
||||||
|
try:D.append(I.index(i))
|
||||||
|
except:D.append(-1)
|
||||||
|
D=list(map(str,D))
|
||||||
|
print(" ".join(D))
|
||||||
10
zeta_python/completed/10950.py
Normal file
10
zeta_python/completed/10950.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
N = range(int(input()))
|
||||||
|
[print(
|
||||||
|
sum(
|
||||||
|
map(
|
||||||
|
int,input().split()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
for i in N
|
||||||
|
]
|
||||||
5
zeta_python/completed/10952.py
Normal file
5
zeta_python/completed/10952.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
while True:
|
||||||
|
s = sum(map(int, input().split()))
|
||||||
|
if s == 0:
|
||||||
|
break
|
||||||
|
print(s)
|
||||||
17
zeta_python/completed/11047.py
Normal file
17
zeta_python/completed/11047.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
N, K = map(int, input().split())
|
||||||
|
A = [int(input())for i in range(N)]
|
||||||
|
|
||||||
|
r = 0
|
||||||
|
back = 1
|
||||||
|
|
||||||
|
while K != 0:
|
||||||
|
for i in A:
|
||||||
|
if i > K:
|
||||||
|
r += K // back
|
||||||
|
K %= back
|
||||||
|
break
|
||||||
|
back = i
|
||||||
|
else:
|
||||||
|
r += K // back
|
||||||
|
K %= back
|
||||||
|
print(r)
|
||||||
6
zeta_python/completed/11365.py
Normal file
6
zeta_python/completed/11365.py
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
while True:
|
||||||
|
i = input()
|
||||||
|
if i == 'END':
|
||||||
|
break
|
||||||
|
i = i[::-1]
|
||||||
|
print(i)
|
||||||
1
zeta_python/completed/11506.py
Normal file
1
zeta_python/completed/11506.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
print("<EFBFBD>")
|
||||||
1
zeta_python/completed/11945.py
Normal file
1
zeta_python/completed/11945.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
for i in range(int(input().split()[0])):print(input()[::-1])
|
||||||
5
zeta_python/completed/11966.py
Normal file
5
zeta_python/completed/11966.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
d=1;n=int(input())
|
||||||
|
while n>=d:
|
||||||
|
if(n==d):print(1);break
|
||||||
|
d*=2
|
||||||
|
else:print(0)
|
||||||
2
zeta_python/completed/13163.py
Normal file
2
zeta_python/completed/13163.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
for i in range(int(input())):print("god"+"".join(input().split()[1:]))
|
||||||
|
|
||||||
2
zeta_python/completed/15552.py
Normal file
2
zeta_python/completed/15552.py
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
from sys import *
|
||||||
|
for i in range(int(stdin.readline().rstrip())):print(sum(list(map(int,stdin.readline().rstrip().split()))))
|
||||||
3
zeta_python/completed/15969.py
Normal file
3
zeta_python/completed/15969.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
input()
|
||||||
|
Case = tuple(map(int, input().split()))
|
||||||
|
print(max(Case)-min(Case))
|
||||||
33
zeta_python/completed/2941.py
Normal file
33
zeta_python/completed/2941.py
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
inp = input()
|
||||||
|
|
||||||
|
l = 0
|
||||||
|
forforw = None
|
||||||
|
forw = ''
|
||||||
|
for i in inp:
|
||||||
|
|
||||||
|
if i == '=':
|
||||||
|
if forw in ('c', 's'):
|
||||||
|
pass
|
||||||
|
|
||||||
|
elif forw == 'z':
|
||||||
|
if forwforw == 'd':
|
||||||
|
l -= 1
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
elif i == '-':
|
||||||
|
if forw in ('c', 'd'):
|
||||||
|
pass
|
||||||
|
elif i == 'j':
|
||||||
|
if forw == 'n' or forw == 'l':
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
l += 1
|
||||||
|
else:
|
||||||
|
l += 1
|
||||||
|
|
||||||
|
forwforw = forw
|
||||||
|
forw = i
|
||||||
|
|
||||||
|
print(l)
|
||||||
7
zeta_python/completed/3053.py
Normal file
7
zeta_python/completed/3053.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
"""
|
||||||
|
|
||||||
|
"""
|
||||||
|
import math
|
||||||
|
r = int(input())
|
||||||
|
print("%.6f"%round(r**2*math.pi,6))
|
||||||
|
print("%.6f"%round(2*r**2,6))
|
||||||
15
zeta_python/completed/4344.py
Normal file
15
zeta_python/completed/4344.py
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
All = int(input())
|
||||||
|
case = []
|
||||||
|
v=0
|
||||||
|
for i in range(All):
|
||||||
|
test = list(map(int,input().split()))
|
||||||
|
case.append(test)
|
||||||
|
for i in range(All):
|
||||||
|
test_all = sum(case[i])-case[i][0]
|
||||||
|
Average = test_all/(len(case[i])-1)
|
||||||
|
for j in range(len(case[i])-1):
|
||||||
|
if Average < case[i][j+1]:
|
||||||
|
v+=1
|
||||||
|
else : pass
|
||||||
|
print("%.3f%%"%(round(((100*v)/(len(case[i])-1)),3)))
|
||||||
|
v=0
|
||||||
11
zeta_python/completed/5086.py
Normal file
11
zeta_python/completed/5086.py
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
while True:
|
||||||
|
inp = tuple(map(int, input().split()))
|
||||||
|
if inp[0] == inp[1] == 0:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
if inp[0] >= inp[1]:
|
||||||
|
s = "multiple" if inp[0] % inp[1] == 0 else "neither"
|
||||||
|
else :
|
||||||
|
s = "factor" if inp[1] % inp[0] == 0 else "neither"
|
||||||
|
|
||||||
|
print(s)
|
||||||
25
zeta_python/completed/9012.py
Normal file
25
zeta_python/completed/9012.py
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
Glevel = 0
|
||||||
|
Nlevel = 0
|
||||||
|
|
||||||
|
testCase = int(input())
|
||||||
|
isVPS = True
|
||||||
|
for i in range(testCase):
|
||||||
|
inString = input()
|
||||||
|
if len(inString) % 2:
|
||||||
|
print("NO")
|
||||||
|
continue
|
||||||
|
for i in inString:
|
||||||
|
if i == "(":
|
||||||
|
Glevel += 1
|
||||||
|
elif i == ")":
|
||||||
|
Glevel -= 1
|
||||||
|
if Glevel < 0:
|
||||||
|
isVPS = False
|
||||||
|
break
|
||||||
|
|
||||||
|
if isVPS and Glevel == 0:
|
||||||
|
print("YES")
|
||||||
|
else :
|
||||||
|
print("NO")
|
||||||
|
isVPS = True
|
||||||
|
Glevel = 0
|
||||||
2
zeta_python/stdin.txt
Normal file
2
zeta_python/stdin.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
5 21
|
||||||
|
1 3 5 9 10
|
||||||
Reference in New Issue
Block a user