https://www.acmicpc.net/problem/13458 13458๋ฒ: ์ํ ๊ฐ๋ ์ฒซ์งธ ์ค์ ์ํ์ฅ์ ๊ฐ์ N(1 ≤ N ≤ 1,000,000)์ด ์ฃผ์ด์ง๋ค. ๋์งธ ์ค์๋ ๊ฐ ์ํ์ฅ์ ์๋ ์์์์ ์ Ai (1 ≤ Ai ≤ 1,000,000)๊ฐ ์ฃผ์ด์ง๋ค. ์ ์งธ ์ค์๋ B์ C๊ฐ ์ฃผ์ด์ง๋ค. (1 ≤ B, C ≤ 1,000,000) www.acmicpc.net #include #include using namespace std; #define MAXN 1000000 int N, B, C; int test[MAXN + 10]; void Input(void) { cin >> N; for (int i = 0; i > test[i]; } cin >> B >> C; } voi..
https://www.acmicpc.net/problem/14499 14499๋ฒ: ์ฃผ์ฌ์ ๊ตด๋ฆฌ๊ธฐ ์ฒซ์งธ ์ค์ ์ง๋์ ์ธ๋ก ํฌ๊ธฐ N, ๊ฐ๋ก ํฌ๊ธฐ M (1 ≤ N, M ≤ 20), ์ฃผ์ฌ์๋ฅผ ๋์ ๊ณณ์ ์ขํ x, y(0 ≤ x ≤ N-1, 0 ≤ y ≤ M-1), ๊ทธ๋ฆฌ๊ณ ๋ช ๋ น์ ๊ฐ์ K (1 ≤ K ≤ 1,000)๊ฐ ์ฃผ์ด์ง๋ค. ๋์งธ ์ค๋ถํฐ N๊ฐ์ ์ค์ ์ง www.acmicpc.net #include #include #include using namespace std; #define MAXN 20 #define MAXN2 1000 int dice[4][3] = { 0, };// ์ฃผ์ฌ์๋ฉด์ ์ ํ์๋ ์ซ์ static int dr[] = { 0, 0, 0, -1, 1 }; static int dc[] = { 0, 1..
์ค๋๋ถํฐ ํ๋ฃจ์ ํ๋๋ฌธ์ ์ฉ ๊ฐ๋ณ์ ์ผ๋ก ์๊ณ ๋ฆฌ์ฆ ๋ฌธ์ ๋ฅผ ํ์ด๋ณด๋ ค๊ณ ํฉ๋๋ค! #include #include using namespace std; #define MAXN 10 int N, M; int RR, RC, BR, BC; int rcnt, bcnt; char map[MAXN + 5][MAXN + 5]; int visited[MAXN + 5][MAXN + 5][MAXN + 5][MAXN + 5]; struct DATA { int rr, rc, br, bc, t; }; queue q; static int dr[] = { -1, 1, 0, 0 }; static int dc[] = { 0, 0, -1, 1 }; void tilt(int &r, int &c, int &cnt, int i) { for (;;) ..
1. Description Write a function to find the longest common prefix string amongst an array of strings. If there is no common prefix, return an empty string "". Example 1: Input: strs = ["flower","flow","flight"] Output: "fl" Example 2: Input: strs = ["dog","racecar","car"] Output: "" Explanation: There is no common prefix among the input strings. Constraints: 1
Description Roman numerals are represented by seven different symbols: I, V, X, L, C, Dand M. Symbol Value I 1 V 5 X 10 L 50 C 100 D 500 M 1000 For example, 2 is written as II in Roman numeral, just two one's added together. 12 is written as XII, which is simply X + II. The number 27 is written as XXVII, which is XX + V + II. Roman numerals are usually written largest to smallest from left to ri..
Description Given an integer x, return true if x is palindrome integer. An integer is a palindrome when it reads the same backward as forward. For example, 121 is palindrome while 123 is not. Example 1: Input: x = 121 Output: true Example 2: Input: x = -121 Output: false Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome. Example..