From 9780f1b7364f7a1975d62d2d275a187d8a21a478 Mon Sep 17 00:00:00 2001 From: yenru0 Date: Fri, 15 Nov 2019 03:29:24 +0900 Subject: [PATCH] 2019-11-15: init --- .gitignore | 2 + PCC/stdin.txt | 0 README.md | 30 +++++++++++ codeup_C/stdin.txt | 0 codeup_python/stdin.txt | 0 zeta_python/1074.py | 36 +++++++++++++ zeta_python/1111.py | 26 ++++++++++ zeta_python/11650.py | 34 ++++++++++++ zeta_python/1193.py | 27 ++++++++++ zeta_python/15649.py | 71 +++++++++++++++++++++++++ zeta_python/1874.py | 94 ++++++++++++++++++++++++++++++++++ zeta_python/2447.py | 51 ++++++++++++++++++ zeta_python/2448.py | 64 +++++++++++++++++++++++ zeta_python/2504.py | 40 +++++++++++++++ zeta_python/completed/10171.py | 4 ++ zeta_python/completed/10809.py | 9 ++++ zeta_python/completed/10950.py | 10 ++++ zeta_python/completed/10952.py | 5 ++ zeta_python/completed/11047.py | 17 ++++++ zeta_python/completed/11365.py | 6 +++ zeta_python/completed/11506.py | 1 + zeta_python/completed/11945.py | 1 + zeta_python/completed/11966.py | 5 ++ zeta_python/completed/13163.py | 2 + zeta_python/completed/15552.py | 2 + zeta_python/completed/15969.py | 3 ++ zeta_python/completed/2941.py | 33 ++++++++++++ zeta_python/completed/3053.py | 7 +++ zeta_python/completed/4344.py | 15 ++++++ zeta_python/completed/5086.py | 11 ++++ zeta_python/completed/9012.py | 25 +++++++++ zeta_python/stdin.txt | 2 + 32 files changed, 633 insertions(+) create mode 100644 .gitignore create mode 100644 PCC/stdin.txt create mode 100644 README.md create mode 100644 codeup_C/stdin.txt create mode 100644 codeup_python/stdin.txt create mode 100644 zeta_python/1074.py create mode 100644 zeta_python/1111.py create mode 100644 zeta_python/11650.py create mode 100644 zeta_python/1193.py create mode 100644 zeta_python/15649.py create mode 100644 zeta_python/1874.py create mode 100644 zeta_python/2447.py create mode 100644 zeta_python/2448.py create mode 100644 zeta_python/2504.py create mode 100644 zeta_python/completed/10171.py create mode 100644 zeta_python/completed/10809.py create mode 100644 zeta_python/completed/10950.py create mode 100644 zeta_python/completed/10952.py create mode 100644 zeta_python/completed/11047.py create mode 100644 zeta_python/completed/11365.py create mode 100644 zeta_python/completed/11506.py create mode 100644 zeta_python/completed/11945.py create mode 100644 zeta_python/completed/11966.py create mode 100644 zeta_python/completed/13163.py create mode 100644 zeta_python/completed/15552.py create mode 100644 zeta_python/completed/15969.py create mode 100644 zeta_python/completed/2941.py create mode 100644 zeta_python/completed/3053.py create mode 100644 zeta_python/completed/4344.py create mode 100644 zeta_python/completed/5086.py create mode 100644 zeta_python/completed/9012.py create mode 100644 zeta_python/stdin.txt diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7242e5c --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.idea/ +output/ \ No newline at end of file diff --git a/PCC/stdin.txt b/PCC/stdin.txt new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md new file mode 100644 index 0000000..97889dd --- /dev/null +++ b/README.md @@ -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`로 이동됩니다. +다만, 그냥 내가 관심을 안줘서 해결되지 않은 문제는 `/`에 있을 예정입니다. + +## 솔직히 이거... +다양한 곳에서의 편리한 코딩 생활을 위한 것입니다. + +네. \ No newline at end of file diff --git a/codeup_C/stdin.txt b/codeup_C/stdin.txt new file mode 100644 index 0000000..e69de29 diff --git a/codeup_python/stdin.txt b/codeup_python/stdin.txt new file mode 100644 index 0000000..e69de29 diff --git a/zeta_python/1074.py b/zeta_python/1074.py new file mode 100644 index 0000000..5415b11 --- /dev/null +++ b/zeta_python/1074.py @@ -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) +''' \ No newline at end of file diff --git a/zeta_python/1111.py b/zeta_python/1111.py new file mode 100644 index 0000000..808e5a7 --- /dev/null +++ b/zeta_python/1111.py @@ -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 +""" \ No newline at end of file diff --git a/zeta_python/11650.py b/zeta_python/11650.py new file mode 100644 index 0000000..4a14915 --- /dev/null +++ b/zeta_python/11650.py @@ -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='') \ No newline at end of file diff --git a/zeta_python/1193.py b/zeta_python/1193.py new file mode 100644 index 0000000..5495c39 --- /dev/null +++ b/zeta_python/1193.py @@ -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 +""" \ No newline at end of file diff --git a/zeta_python/15649.py b/zeta_python/15649.py new file mode 100644 index 0000000..1416500 --- /dev/null +++ b/zeta_python/15649.py @@ -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 +``` +""" diff --git a/zeta_python/1874.py b/zeta_python/1874.py new file mode 100644 index 0000000..4efe6c4 --- /dev/null +++ b/zeta_python/1874.py @@ -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 diff --git a/zeta_python/2447.py b/zeta_python/2447.py new file mode 100644 index 0000000..14d459c --- /dev/null +++ b/zeta_python/2447.py @@ -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) \ No newline at end of file diff --git a/zeta_python/2448.py b/zeta_python/2448.py new file mode 100644 index 0000000..cc56157 --- /dev/null +++ b/zeta_python/2448.py @@ -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) \ No newline at end of file diff --git a/zeta_python/2504.py b/zeta_python/2504.py new file mode 100644 index 0000000..72047ec --- /dev/null +++ b/zeta_python/2504.py @@ -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()) \ No newline at end of file diff --git a/zeta_python/completed/10171.py b/zeta_python/completed/10171.py new file mode 100644 index 0000000..7446c8a --- /dev/null +++ b/zeta_python/completed/10171.py @@ -0,0 +1,4 @@ +print("""\ /\\ + ) ( ') +( / ) + \(__)|""") \ No newline at end of file diff --git a/zeta_python/completed/10809.py b/zeta_python/completed/10809.py new file mode 100644 index 0000000..456ae14 --- /dev/null +++ b/zeta_python/completed/10809.py @@ -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)) diff --git a/zeta_python/completed/10950.py b/zeta_python/completed/10950.py new file mode 100644 index 0000000..21ff931 --- /dev/null +++ b/zeta_python/completed/10950.py @@ -0,0 +1,10 @@ +N = range(int(input())) +[print( + sum( + map( + int,input().split() + ) + ) +) + for i in N +] diff --git a/zeta_python/completed/10952.py b/zeta_python/completed/10952.py new file mode 100644 index 0000000..d6f7c22 --- /dev/null +++ b/zeta_python/completed/10952.py @@ -0,0 +1,5 @@ +while True: + s = sum(map(int, input().split())) + if s == 0: + break + print(s) diff --git a/zeta_python/completed/11047.py b/zeta_python/completed/11047.py new file mode 100644 index 0000000..853f23a --- /dev/null +++ b/zeta_python/completed/11047.py @@ -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) \ No newline at end of file diff --git a/zeta_python/completed/11365.py b/zeta_python/completed/11365.py new file mode 100644 index 0000000..48f5fe0 --- /dev/null +++ b/zeta_python/completed/11365.py @@ -0,0 +1,6 @@ +while True: + i = input() + if i == 'END': + break + i = i[::-1] + print(i) diff --git a/zeta_python/completed/11506.py b/zeta_python/completed/11506.py new file mode 100644 index 0000000..ff30234 --- /dev/null +++ b/zeta_python/completed/11506.py @@ -0,0 +1 @@ +print("�") diff --git a/zeta_python/completed/11945.py b/zeta_python/completed/11945.py new file mode 100644 index 0000000..e3f12e1 --- /dev/null +++ b/zeta_python/completed/11945.py @@ -0,0 +1 @@ +for i in range(int(input().split()[0])):print(input()[::-1]) \ No newline at end of file diff --git a/zeta_python/completed/11966.py b/zeta_python/completed/11966.py new file mode 100644 index 0000000..aaa0fa6 --- /dev/null +++ b/zeta_python/completed/11966.py @@ -0,0 +1,5 @@ +d=1;n=int(input()) +while n>=d: + if(n==d):print(1);break + d*=2 +else:print(0) diff --git a/zeta_python/completed/13163.py b/zeta_python/completed/13163.py new file mode 100644 index 0000000..72a483f --- /dev/null +++ b/zeta_python/completed/13163.py @@ -0,0 +1,2 @@ +for i in range(int(input())):print("god"+"".join(input().split()[1:])) + diff --git a/zeta_python/completed/15552.py b/zeta_python/completed/15552.py new file mode 100644 index 0000000..aa5bb9d --- /dev/null +++ b/zeta_python/completed/15552.py @@ -0,0 +1,2 @@ +from sys import * +for i in range(int(stdin.readline().rstrip())):print(sum(list(map(int,stdin.readline().rstrip().split())))) \ No newline at end of file diff --git a/zeta_python/completed/15969.py b/zeta_python/completed/15969.py new file mode 100644 index 0000000..b497610 --- /dev/null +++ b/zeta_python/completed/15969.py @@ -0,0 +1,3 @@ +input() +Case = tuple(map(int, input().split())) +print(max(Case)-min(Case)) \ No newline at end of file diff --git a/zeta_python/completed/2941.py b/zeta_python/completed/2941.py new file mode 100644 index 0000000..68b3563 --- /dev/null +++ b/zeta_python/completed/2941.py @@ -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) diff --git a/zeta_python/completed/3053.py b/zeta_python/completed/3053.py new file mode 100644 index 0000000..fd9deab --- /dev/null +++ b/zeta_python/completed/3053.py @@ -0,0 +1,7 @@ +""" + +""" +import math +r = int(input()) +print("%.6f"%round(r**2*math.pi,6)) +print("%.6f"%round(2*r**2,6)) \ No newline at end of file diff --git a/zeta_python/completed/4344.py b/zeta_python/completed/4344.py new file mode 100644 index 0000000..025e6a5 --- /dev/null +++ b/zeta_python/completed/4344.py @@ -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 \ No newline at end of file diff --git a/zeta_python/completed/5086.py b/zeta_python/completed/5086.py new file mode 100644 index 0000000..60b9dea --- /dev/null +++ b/zeta_python/completed/5086.py @@ -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) diff --git a/zeta_python/completed/9012.py b/zeta_python/completed/9012.py new file mode 100644 index 0000000..eb2d119 --- /dev/null +++ b/zeta_python/completed/9012.py @@ -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 \ No newline at end of file diff --git a/zeta_python/stdin.txt b/zeta_python/stdin.txt new file mode 100644 index 0000000..a45ca11 --- /dev/null +++ b/zeta_python/stdin.txt @@ -0,0 +1,2 @@ +5 21 +1 3 5 9 10 \ No newline at end of file