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
- BOJ
- 다이나믹 프로그래밍
- SWEA
- dynamic programming
- 백트래킹
- PS
- 구현
- 삼성 기출
- 그리디
- hackerrank
- 시뮬레이션
- koitp
- 삼성 SDS 대학생 알고리즘 특강
- 백준
- Algorithm
- 스택
- sw expert academy
- 해커랭크
- 브루트포스
- 소수
- C++
- DP
- 완전탐색
- BFS
- 알고리즘
- 에라토스테네스의 체
- dfs
- 잠실
- 동적 계획법
- 맛집
Archives
- Today
- Total
펭로그
[C++] HackerRank 해커랭크 Flipping the Matrix 본문
문제링크 : https://www.hackerrank.com/challenges/flipping-the-matrix
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 29 30 31 | #include <bits/stdc++.h> using namespace std; int main() { int queries; // 1 <= q <= 16 int n; // 1 <= n <= 128 cin >> queries; for(int q = 0; q < queries; q++){ cin >> n; long int** matrix = new long int*[2*n]; for(int i = 0; i < 2*n; i++) matrix[i] = new long int[2*n]; for(int i = 0; i < 2*n; i++) for(int j = 0; j < 2*n; j++) cin >> matrix[i][j]; long int sum = 0; for(int i = 0; i < n; i++) for(int j = 0; j < n; j++){ sum += max(matrix[i][j], max(matrix[i][2*n-1-j], max(matrix[2*n-1-i][j], matrix[2*n-1-i][2*n-1-j]))); } cout << sum << endl; } return 0; } | cs |
'Study > PS(Algorithm)' 카테고리의 다른 글
[C++] HackerRank 해커랭크 Counter game (0) | 2018.04.10 |
---|---|
[C++] HackerRank 해커랭크 Tower Breakers (0) | 2018.03.24 |
[C++] HackerRank 해커랭크 Sansa and XOR (0) | 2018.03.22 |
[C++] HackerRank 해커랭크 Connected Cells in a Grid (0) | 2018.03.16 |
[C++] HackerRank 해커랭크 Forming a Magic Square (0) | 2018.03.14 |
Comments