본문 바로가기

백준

(497)
[백준 2294번] 동전 2 (C++) 문제링크 : https://www.acmicpc.net/problem/2294 2294번: 동전 2 첫째 줄에 n, k가 주어진다. (1 ≤ n ≤ 100, 1 ≤ k ≤ 10,000) 다음 n개의 줄에는 각각의 동전의 가치가 주어진다. 동전의 가치는 100,000보다 작거나 같은 자연수이다. 가치가 같은 동전이 여러 번 주어 www.acmicpc.net #include using namespace std; typedef long long ll; typedef pair pii; const int MAX = 987654321; int N, K; int arr[101]; int dp[1000001]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >..
[백준 11057번] 오르막 수 (C++) 문제링크 : https://www.acmicpc.net/problem/11057 11057번: 오르막 수 오르막 수는 수의 자리가 오름차순을 이루는 수를 말한다. 이때, 인접한 수가 같아도 오름차순으로 친다. 예를 들어, 2234와 3678, 11119는 오르막 수이지만, 2232, 3676, 91111은 오르막 수가 아니다. 수 www.acmicpc.net #include using namespace std; typedef long long ll; typedef pair pii; const int MAX = 987654321; int N, result; int dp[1001][10]; const int MOD = 10007; int main() { ios_base::sync_with_stdio(0); ..
[백준 2293번] 동전 1 (C++) 문제링크 : https://www.acmicpc.net/problem/2293 2293번: 동전 1 첫째 줄에 n, k가 주어진다. (1 ≤ n ≤ 100, 1 ≤ k ≤ 10,000) 다음 n개의 줄에는 각각의 동전의 가치가 주어진다. 동전의 가치는 100,000보다 작거나 같은 자연수이다. www.acmicpc.net #include using namespace std; typedef long long ll; typedef pair pii; const int MAX = 987654321; int arr[101]; int dp[10001]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int N, K; cin >> N >> K; for(int i=0..
[백준 1106번] 호텔 (C++) 문제링크 : https://www.acmicpc.net/problem/1106 1106번: 호텔 첫째 줄에 C와 형택이가 홍보할 수 있는 도시의 개수 N이 주어진다. C는 1,000보다 작거나 같은 자연수이고, N은 20보다 작거나 같은 자연수이다. 둘째 줄부터 N개의 줄에는 각 도시에서 홍보할 때 www.acmicpc.net #include using namespace std; typedef long long ll; typedef pair pii; const int MAX = 987654321; vectorv; int dp[100001]; int result = MAX; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int C, N; cin >> C ..
[백준 9466번] 텀 프로젝트 (C++) 문제링크 : https://www.acmicpc.net/problem/9466 9466번: 텀 프로젝트 이번 가을학기에 '문제 해결' 강의를 신청한 학생들은 텀 프로젝트를 수행해야 한다. 프로젝트 팀원 수에는 제한이 없다. 심지어 모든 학생들이 동일한 팀의 팀원인 경우와 같이 한 팀만 있을 www.acmicpc.net #include using namespace std; typedef long long ll; typedef pair pii; const int MAX = 987654321; int N, result; int arr[100001]; int visited[100001]; void func(int idx) { int cur = idx; while(1) { visited[cur]=idx; cur ..
[백준 2342번] Dance Dance Revolution (C++) 문제링크 : https://www.acmicpc.net/problem/2342 2342번: Dance Dance Revolution 입력은 지시 사항으로 이루어진다. 각각의 지시 사항은 하나의 수열로 이루어진다. 각각의 수열은 1, 2, 3, 4의 숫자들로 이루어지고, 이 숫자들은 각각의 방향을 나타낸다. 그리고 0은 수열의 마 www.acmicpc.net #include using namespace std; typedef long long ll; typedef pair pii; const int MAX = 987654321; int dp[100001][5][5]; vectorv; int move(int a, int b) { if(a==b) return 1; //똑같은 위치로 이동 else if(a==0..
[백준 15235번] Olympiad Pizza (C++) 문제링크 : https://www.acmicpc.net/problem/15235 15235번: Olympiad Pizza The contestants that get a slice are, in order: 1, 2, 3, 4, 2, 4, 2, 4, 4. So at t=1s the first contestant get all slices, at t=3s the third contestant gets a slice, at t=7s the second student finishes and finally at t=9s the fourth student gets the last s www.acmicpc.net #include using namespace std; typedef long long ll; typed..
[백준 1788번] 피보나치 수의 확장 (C++) 문제링크 : https://www.acmicpc.net/problem/1788 1788번: 피보나치 수의 확장 첫째 줄에 F(n)이 양수이면 1, 0이면 0, 음수이면 -1을 출력한다. 둘째 줄에는 F(n)의 절댓값을 출력한다. 이 수가 충분히 커질 수 있으므로, 절댓값을 1,000,000,000으로 나눈 나머지를 출력한다. www.acmicpc.net #include using namespace std; typedef long long ll; typedef pair pii; const int MAX = 987654321; const int MOD = 1000000000; int dp[1000001]; int sign=1; int main() { ios_base::sync_with_stdio(0); ci..