재귀로 푸는 방법 N = int(input()) def factorial(N): if N 0: factorial *= N N-=1 print(factorial) import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); System.out.println(f..
n = int(input()) result = 0 for i in range(1, n + 1): if i
s = set(range(1, 10001)) for i in range(1, 10001): sum = i for ch in str(i): sum += int(ch) if sum in s: s.remove(sum) for i in s: print(i) public class Main { public static int calculate( int n) { int result = n; while (n > 0) { result += (n % 10); n /= 10; } return result; } public static void main(String[] args) { int num_arr[] = new int[10001]; for(int i=1; i
bur_min = 2000 bev_min = 2000 for i in range(3): n = int(input()) bur_min = min(n, bur_min) for i in range(2): m = int(input()) bev_min = min(bev_min, m) print(bur_min + bev_min - 50) import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(ne..
a = [] for i in range(10): num = int(input()) a.append(num%42) # 나머지를 리스트에 넣음 a = list(set(a)) # 중복제거 print(len(a)) import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashSet; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); HashSet h..
n = int(input()) result = 0 for i in range(n): line = input() a = {} # 빈 딕셔너리 생성 count = 0 for j in range(len(line)): if line[j] in a and a[line[j]] == (j-1): #문자가 연속해서 나타날 경우 a[line[j]] = j elif line[j] in a and a[line[j]] != (j-1): #문자가 연속하지 않을 경우 break else: #문자가 딕셔너리에 없는 경우 딕셔너리에 추가 a[line[j]] = j count += 1 if count == len(line): result += 1 print(result) import java.io.BufferedReader; impo..
★다시 a = ['c=', 'c-', 'dz=', 'd-', 'lj', 'nj', 's=', 'z='] b = input() for i in a: b = b.replace(i, 'a') print(len(b)) import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] croatia = {"c=", "c-", "..
word = input() num = ['ABC', 'DEF', 'GHI', 'JKL', 'MNO', 'PQRS', 'TUV', 'WXYZ'] sum = len(word) for i in range(len(word)): for j in num: if word[i] in j: sum += (num.index(j)+2) print(sum) import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedRead..
line = input()[::-1] a, b = line.split() if int(a) >= int(b): print(a) else: print(b) import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] num = br.readLine().split(" "); br.close(); for(int i=0;..
line = input().split() print(len(line)) import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; public class Main { public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine(), " "); System.out.prin..