코테 대비 python/백준
-
2675 문자열코테 대비 python/백준 2023. 1. 31. 11:24
https://www.acmicpc.net/problem/2675 2675번: 문자열 반복 문자열 S를 입력받은 후에, 각 문자를 R번 반복해 새 문자열 P를 만든 후 출력하는 프로그램을 작성하시오. 즉, 첫 번째 문자를 R번 반복하고, 두 번째 문자를 R번 반복하는 식으로 P를 만들면 된다 www.acmicpc.net T= int(input()) for k in range(T): R, S = map(str, input().split()) for i in range(len(S)): for _ in range(int(R)): print(S[i],end='') print() https://ooyoung.tistory.com/69 *되는구나? n = int(input()) for _ in range(n): c..
-
10809 공식을 유도하지말고 외우자코테 대비 python/백준 2023. 1. 31. 11:00
https://www.acmicpc.net/problem/10809 10809번: 알파벳 찾기 각각의 알파벳에 대해서, a가 처음 등장하는 위치, b가 처음 등장하는 위치, ... z가 처음 등장하는 위치를 공백으로 구분해서 출력한다. 만약, 어떤 알파벳이 단어에 포함되어 있지 않다면 -1을 출 www.acmicpc.net s= input() test=[] test_s=[] cnt=0 for i in s: if i in test_s: cnt+=1 else: test_s.append(i) test.append([i,cnt]) cnt+=1 alpha=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v",..
-
11654 아스키코드코테 대비 python/백준 2023. 1. 31. 09:43
https://www.acmicpc.net/problem/11654 11654번: 아스키 코드 알파벳 소문자, 대문자, 숫자 0-9중 하나가 주어졌을 때, 주어진 글자의 아스키 코드값을 출력하는 프로그램을 작성하시오. www.acmicpc.net #숫자 아스키코드 chr() #문자 아스키코드 ord() n=input() a=["0","1","2","3","4","5","6","7","8","9"] if n in a: #n=int(n) #print(chr(n)) print(ord(n)) else: print(ord(n)) ord() : 문자의 아스키 코드값을 리턴하는 함수이다. chr() : 아스키 코드값 입력으로 받아 그 코드에 해당하는 문자를 출력하는 함수이다. 맨첨에 조건있길레 써야되는줄 알았는데 알..
-
1110 문자열+while코테 대비 python/백준 2023. 1. 30. 21:43
https://www.acmicpc.net/problem/1110 1110번: 더하기 사이클 0보다 크거나 같고, 99보다 작거나 같은 정수가 주어질 때 다음과 같은 연산을 할 수 있다. 먼저 주어진 수가 10보다 작다면 앞에 0을 붙여 두 자리 수로 만들고, 각 자리의 숫자를 더한다. 그 다음, www.acmicpc.net cnt=0 T = int(input()) N = T while True: cnt+=1 if N < 10: N = N*10+N else: N = str(N) tmp = int(N[-1])+int(N[0]) tmp = str(tmp) N = int(N[-1])*10+int(tmp[-1]) if N==T: print(cnt) break
-
10952 while 문!코테 대비 python/백준 2023. 1. 30. 21:09
https://www.acmicpc.net/problem/10952 10952번: A+B - 5 두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오. www.acmicpc.net a,b=map(int,input().split()) while (a,b) != (0,0): print(a+b) a,b=map(int,input().split()) ########################################### while True: a, b = map(int, input().split()) if a == 0 and b == 0: break print(a+b)