티스토리 뷰
블록의 최대값
#include <iostream>
#include <vector>
#include <algorithm>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int a[3][11];
int main() {
//freopen("input.txt", "rt", stdin);
int i, j, n, cnt=0,tmp;
scanf("%d", &n);
for(i=1; i<=2; i++){
for(j=1; j<=n; j++){
scanf("%d", &tmp);
a[i][j] = tmp;
}
}
for(i=1; i<=n; i++){
for(j=n; j>=1; j--){
if(a[1][i]<a[2][j]) cnt+=a[1][i];
else cnt+=a[2][j];
}
}
printf("%d ", cnt);
return 0;
}
'lecture > algorithm - c++' 카테고리의 다른 글
[c++] ++a, a++ 전위연산자, 후위연산자 예제 (0) | 2020.12.31 |
---|---|
[c++] 영지선택 small, large (0) | 2020.12.30 |
[c++] 봉우리, 각 행의 평균과 가장 가까운 값 (0) | 2020.12.29 |
[c++] 공주구하기, 멀티 태스킹 (0) | 2020.12.27 |
[c++] 뮤직비디오, 마구간 정하기 (0) | 2020.12.26 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 클래스
- 재귀함수
- 동적프로그래밍
- 이진탐색
- 최단경로
- stackframe
- client side rendering
- 자료구조
- Java
- 구조체
- Stack
- 스텍
- 인접리스트
- 병행프로세스
- 세마포어
- 인접행렬
- 퀵정렬
- C++
- 소프트웨어
- 운영체제
- server side rendering
- BFS
- 배열
- react
- javascript
- 입출력장치
- dfs
- 알고리즘
- C
- 교착상태
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
글 보관함