물먹는산세베리아

[BOJ] 2775번: 부녀회장이 될테야 본문

Algorithm/백준

[BOJ] 2775번: 부녀회장이 될테야

suntall 2021. 2. 14. 02:01
#include <iostream>
using namespace std;

int main() {
	int answer = 0;
	int test;
	cin >> test;
	int* k = new int[test];
	int* n = new int[test];
	
	//int a[14] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14 };

	for (int i = 0; i < test; i++) {
		cin >> k[i];
		cin >> n[i];
	}

	for (int i = 0; i < test; i++) {
		
		int a[14] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14 };
		for (int j = 0; j < k[i]; j++) {
			answer = 0;
			for (int m = 0; m < n[i]; m++) {
				answer += a[m];
				//cout << "answer=" << answer << endl;
				a[m] = answer;
				/*for (int h = 0; h < 14; h++) {
					cout << a[h] << " ";
				}*/
			}
		}
		cout << answer<<endl;
	}
	return 0;
}

'Algorithm > 백준' 카테고리의 다른 글

[BOJ] 4153번: 직사각형 C++  (0) 2021.02.28
[BOJ] 1085번: 직사각형에서 탈출  (0) 2021.02.23
[BOJ]1193번: 분수찾기  (0) 2021.02.15