728x90
(n1, n2)평균과 n1을 가지고 n2를 찾는 문제입니다.
평균 * 2 - n1을 해서 n2를 찾았습니다.
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
int main(int argc, char* argv[])
{
int n, avg;
int result;
cin >> n >> avg;
result = (avg * 2) - n;
cout << result << endl;
return 0;
}
'알고리즘' 카테고리의 다른 글
[C++] 백준 2010번 플러그 (0) | 2019.09.13 |
---|---|
[C++] 백준 1094번 막대기 (0) | 2019.09.13 |
[C++] 백준 10798번 세로읽기 (0) | 2019.09.13 |
[C++] 백준 2960번 에라토스테네스의 체 (0) | 2019.09.13 |
[C++] 백준 10886번 0 = not cute / 1 = cute (0) | 2019.09.13 |