본문 바로가기

Programming/BaekJoon

[C++] 백준 2010번 : 플러그


https://www.acmicpc.net/problem/2010




#include <iostream>


using namespace std;


int main() {

int tc;

cin >> tc;

int n,cnt =0;

for (int i = 0; i < tc - 1; i++) {

cin >> n;

cnt += n - 1;

}

cin >> n;

cnt += n;


cout << cnt;

}

'Programming > BaekJoon' 카테고리의 다른 글

[C++] 백준 1037번 : 약수  (0) 2019.04.02
[C++] 백준 1977번 : 완전제곱수  (0) 2019.04.02
[C++] 백준 10866번 : 덱  (0) 2019.04.02
[C++] 백준 1003번 : 피보나치 함수  (0) 2019.03.26
[C++] 백준 11004번 : K번째 수  (0) 2019.03.18