Algorithm/Python, C++

백준 15552_빠른 A+B[C++]

liveloper jay 2022. 1. 13. 23:50

문제

 

풀이

문제에 주어진 힌트를 이용하여 문제를 풀어주면 쉽게 해결할 수 있는 문제입니다. (주어진 힌트를 이용하지 않을 시 시간초과가 발생하여 틀리게 됩니다.)

 

 

 

소스코드

#include <iostream>
using namespace std;


int main()
{
    cin.tie(NULL);
    ios::sync_with_stdio(false);
    int n, a, b;
    
    cin >> n;
    int result[n];
    for (int i = 0; i < n; i++)
    {
        cin >> a >> b;
        result[i] = a+b;
    }
    for (int j = 0; j < n; j++)
    {
        cout << result[j] << '\n';
    }
}