Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 에라토스테네스의 체
- 소수
- SWEA
- BOJ
- Algorithm
- 완전탐색
- 동적 계획법
- 백트래킹
- koitp
- sw expert academy
- dfs
- 알고리즘
- 해커랭크
- 그리디
- 스택
- DP
- C++
- 구현
- PS
- hackerrank
- 백준
- 브루트포스
- 맛집
- 삼성 기출
- 삼성 SDS 대학생 알고리즘 특강
- 잠실
- 다이나믹 프로그래밍
- 시뮬레이션
- dynamic programming
- BFS
Archives
- Today
- Total
펭로그
[C++] HackerRank 해커랭크 Tower Breakers 본문
문제링크 : https://www.hackerrank.com/challenges/tower-breakers-1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | #include <bits/stdc++.h> using namespace std; int towerBreakers(int n, int m) { if(m == 1) return 2; if(n % 2) return 1; else return 2; } int main() { int t; cin >> t; for(int i = 0; i < t; i++){ int n; int m; cin >> n >> m; int result = towerBreakers(n, m); cout << result << endl; } return 0; } | cs |
'Study > PS(Algorithm)' 카테고리의 다른 글
[C++] HackerRank 해커랭크 Roads and Libraries (0) | 2018.04.16 |
---|---|
[C++] HackerRank 해커랭크 Counter game (0) | 2018.04.10 |
[C++] HackerRank 해커랭크 Sansa and XOR (0) | 2018.03.22 |
[C++] HackerRank 해커랭크 Flipping the Matrix (0) | 2018.03.21 |
[C++] HackerRank 해커랭크 Connected Cells in a Grid (0) | 2018.03.16 |
Comments