-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path18229.cpp
58 lines (54 loc) · 1.06 KB
/
18229.cpp
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// 18229. 내가 살게, 아냐 내가 살게
// 2019.12.24
// 배열
#include<iostream>
using namespace std;
int cost[101][101];
int accumulate[101][101];
int main()
{
int n, m, k;
cin >> n >> m >> k;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
cin >> cost[i][j];
}
}
for (int i = 0; i < n; i++)
{
accumulate[i][0] = cost[i][0];
}
for (int i = 0; i < n; i++)
{
for (int j = 1; j < m; j++)
{
accumulate[i][j] = accumulate[i][j - 1] + cost[i][j];
}
}
bool flag = true;
int ansIdx = 0;
int ansCnt = 0;
int cnt = 0;
for (int i = 0; i < m; i++)
{
cnt++;
if (!flag)
{
break;
}
for (int j = 0; j < n; j++)
{
if (accumulate[j][i] >= k)
{
flag = false;
ansIdx = j+1;
ansCnt = cnt;
break;
}
}
}
cout << ansIdx << " " << ansCnt << endl;
return 0;
}