1. 프로그래머스 기출 문제
This commit is contained in:
21
과제2폴더/2-2.txt
Normal file
21
과제2폴더/2-2.txt
Normal file
@@ -0,0 +1,21 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int solution(vector<vector<int>> board, int k) {
|
||||
int answer = 0;
|
||||
|
||||
for (int i=0; i<board.size(); i++)
|
||||
{
|
||||
for (int j=0; j<board[i].size(); j++)
|
||||
{
|
||||
if (i+j <= k)
|
||||
{
|
||||
answer += board[i][j];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return answer;
|
||||
}
|
Reference in New Issue
Block a user