문제 : https://www.acmicpc.net/problem/16673


[알고리즘풀이]

문제에 맞춰서 단순 구현을 하면 된다.

#include<iostream>

using namespace std;

int main(void) {
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);

	int c, k, p, ans = 0;
	cin >> c >> k >> p;

	for (int i = 1; i <= c; i++)
		ans += k * i + p * i * i;
	cout << ans;
}

 

'Problem Solving > BOJ' 카테고리의 다른 글

[BOJ] 15781 - 헬멧과 조끼  (0) 2019.09.29
[BOJ] 16486 - 운동장 한 바퀴  (0) 2019.09.29
[BOJ] 3896 - Prime Gap  (0) 2019.09.29
[BOJ] 3474 - Factorial  (0) 2019.09.29
[BOJ] 2153 - 소수단어  (0) 2019.09.29

+ Recent posts