븅딱같이 vector 초기화 안해줘서 삽질했다....
int i; int j; int num; int temp; vector<int> input_sum; vector<int> input_temp; vector <vector <int> > input; cin >> num; for(i = 0; i < num; i++){ cin >> temp; input_sum.push_back(temp); for(j = 0; j < 9; j++){ cin >> temp; input_temp.push_back(temp); } input.push_back(input_temp); input_temp.clear(); } for(i = 0; i < num; i++){ decide(input_sum[i], input[i]); } } void decide(int input_sum, vector<int> &input){ int sum = 0; int i; for(i = 0; i < 9 ; i++){ sum += input[i]; } if(input_sum >= sum) cout << "YES" << endl; else cout << "NO" << endl; }
'programming > 알고스팟' 카테고리의 다른 글
알고스팟 - 튜토리얼 XHAENEUNG (0) | 2020.05.16 |
---|---|
알고스팟 - 튜토리얼 URI (0) | 2020.05.15 |
알고스팟 - 튜토리얼 mispell (0) | 2020.05.14 |
알고스팟 - 튜토리얼 encrypt (0) | 2020.05.14 |
알고스팟 - 튜토리얼 LECTURE (0) | 2020.05.14 |
댓글