자기개발👨‍💻 142

[python] 백준 2588 곱셈

https://www.acmicpc.net/problem/2588 5613번: 계산기 프로그램 입력의 각 줄에는 숫자와 +, -, *, /, =중 하나가 교대로 주어진다. 첫 번째 줄은 수이다. 연산자의 우선 순위는 생각하지 않으며, 입력 순서대로 계산을 하고, =가 주어지면, 그때까지의 결과를 출�� www.acmicpc.net one = int(input()) two = input() three = one*int(two[2]) four = one*int(two[1]) five = one*int(two[0]) six = three+four*10+five*100 print(three,four,five,six,sep='\n')

[python] 백준 1789 블랙잭

https://www.acmicpc.net/problem/2789 5613번: 계산기 프로그램 입력의 각 줄에는 숫자와 +, -, *, /, =중 하나가 교대로 주어진다. 첫 번째 줄은 수이다. 연산자의 우선 순위는 생각하지 않으며, 입력 순서대로 계산을 하고, =가 주어지면, 그때까지의 결과를 출�� www.acmicpc.net from itertools import combinations number, limit = input().split() number=int(number) limit=int(limit) numbers=[] numbers=list((map(int,input().split()))) maxx=numbers[0] tmp = list(combinations(numbers,3)) cnt=0..

[c++] 백준 1652 누울 자리를 찾아라

https://www.acmicpc.net/problem/1652 1652번: 누울 자리를 찾아라 첫째 줄에 방의 크기 N이 주어진다. N은 1이상 100이하의 정수이다. 그 다음 N줄에 걸쳐 N개의 문자가 들어오는데 '.'은 아무것도 없는 곳을 의미하고, 'X'는 짐이 있는 곳을 의미한다. www.acmicpc.net #include #include using namespace std; int main() { int n; int cnta = 0; int cntb = 0; int dot = 0; string arr[100]; cin >> n; for (int i = 0; i > arr[i]; } //가로 카운트 시작 for (int i = 0; i < n; i++) { fo..

[python] 백준 6603 로또

https://www.acmicpc.net/problem/6603 6603번: 로또 문제 독일 로또는 {1, 2, ..., 49}에서 수 6개를 고른다. 로또 번호를 선택하는데 사용되는 가장 유명한 전략은 49가지 수 중 k(k>6)개의 수를 골라 집합 S를 만든 다음 그 수만 가지고 번호를 선택하는 www.acmicpc.net from itertools import combinations while(1): inp = list(map(int,input().split())) number = inp[0] if number==0: break inp= inp[1:] arr=inp[:] tmp = list(combinations(arr,6)) for i in range(len(tmp)): for j in rang..

[c++] 백준 1912 연속합

#include #include using namespace std; int arr[100000]; int dp[100000]; int main() { int n; cin >> n; for (int i = 0; i > arr[i]; } //dp는 dp[0] = arr[0]; //기본적으로 첫번째 인덱스는 같다, 먼저 초기화해주기 for (int i = 1; i < n; i++) { dp[i] = max(dp[i - 1] + arr[i], arr[i]); } int Max = dp[0]; //입력조건을 보고 나올 수 없는 수 중에서 가장 작은수로 초기화하기 or 현재 dp배열에서 가장 작은수 for (int i = 0; i < n; i++) if (Max < dp[i]) Ma..

[C++] 백준 12919 A와 B 2

https://www.acmicpc.net/problem/12919 12919번: A와 B 2 수빈이는 A와 B로만 이루어진 영어 단어 존재한다는 사실에 놀랐다. 대표적인 예로 AB (Abdominal의 약자), BAA (양의 울음 소리), AA (용암의 종류), ABBA (스웨덴 팝 그룹)이 있다. 이런 사실에 놀란 수빈 www.acmicpc.net #include #include #include #include using namespace std; int main() { string s, t; queue q; cin >> s; cin >> t; string front1, front2; q.push(t); while (!q.empty()) { front1 = q.front(); front2 = q.fr..

[python] 백준 1543 문서검색

https://www.acmicpc.net/problem/1543 1543번: 문서 검색 세준이는 영어로만 이루어진 어떤 문서를 검색하는 함수를 만들려고 한다. 이 함수는 어떤 단어가 총 몇 번 등장하는지 세려고 한다. 그러나, 세준이의 함수는 중복되어 세는 것은 빼고 세야 한� www.acmicpc.net a=[] a=input() find=[] find=input() cnt=0 for i in range(len(a)): for j in range(i,len(a)): if a[0:len(find)]==find: a=a[len(find):] cnt+=1 else: a=a[1:] print(cnt) 내가 찾으려는 find가 있으면 a를 find만큼 자르고, 그렇지 않으면 맨 앞 글자를 하나씩 지워가면서 문..