본문 바로가기

Programming/BaekJoon

[C++] 백준 10040번 : 투표 https://www.acmicpc.net/problem/10040 #include using namespace std;int main() {int n, m;cin >> n >> m;int *A = new int[n];int *cnt = new int[n];int *B = new int[m]; for (int i = 0; i > A[i];for (int i = 0; i > B[i]; for (int i = 0; i < m; i++)for (int j = 0; j < n; j++)if (A[j] max){max = cnt[i];max_index = i;} cout 더보기
[C++] 백준 11653번 : 소인수분해 https://www.acmicpc.net/problem/11653 #include using namespace std;int main() {int num;cin >> num;for (int i = 2; i 더보기
[C] 백준 11942번 : 고려대는 사랑입니다 https://www.acmicpc.net/problem/11942 #include int main() {printf("고려대학교");} 더보기
[C++] 백준 12790번 : Mini Fantasy War https://www.acmicpc.net/problem/12790 #include using namespace std;int main() {int tc;cin >> tc; int a[8];for (int j = 0; j > a[i];a[0] += a[4];a[1] += a[5];a[2] += a[6];a[3] += a[7]; a[0] < 1 ? a[0] = 1 : 0;a[1] < 1 ? a[1] = 1 : 0;a[2] < 0 ? a[2] = 0 : 0; cout 더보기
[C++] 백준 12791번 : Starman https://www.acmicpc.net/problem/12791 #include using namespace std; void track(int n);int count(int n);int main() {int tc;cin >> tc; int a, b, sum;for (int i = 0; i > a >> b;for (int j = a; j 더보기
[C++] 백준 14581번 : 팬들에게 둘러싸인 홍준 https://www.acmicpc.net/problem/14581 #include #include using namespace std;int main() {string name;cin >> name;char em[6] = ":fan:";for (int i = 0; i < 3; i++){for (int j = 0; j < 3; j++){if (i == 1 && j == 1) {cout 더보기
[C++] 백준 14582번 : 오늘도 졌다 https://www.acmicpc.net/problem/14582 #include using namespace std;#define FOR(n) for(int i=0 ; i> a[i];if (i != 0) a[i] += a[i - 1];}FOR(9){cin >> b[i];if (i != 0)b[i] += b[i - 1];} int flag = 0;FOR(9) {if(i != 0) {if (a[i] > b[i - 1]){flag = 1;break;}}elseif (a[0] > 0){flag = 1;break;}} if ((a[8] < b[8])&&(flag==1))cout 더보기
[C++] 백준 10828번 : 스택 https://www.acmicpc.net/problem/10828 #include #include #include using namespace std; #define FOR(b) for(int i=0; i> n;int n1;string a;FOR(n) {cin >> a;if (a == "push"){cin >> n1;k1.push(n1);}else if (a == "pop") cout 더보기