https://www.acmicpc.net/problem/31403
#include <iostream>
#include <string>
using namespace std;
int main(void) {
// C++ Init
ios::sync_with_stdio(false);
cin.tie(NULL);
int input1, input2, input3;
cin >> input1 >> input2 >> input3;
cout << input1 + input2 - input3 << "\n";
string str = to_string(input1) + to_string(input2);
cout << stoi(str) - input3;
}
to_string
정수를 문자/문자열로 변환 (string 헤더파일)
stoi
문자/문자열을 정수로 변환
'알고리즘' 카테고리의 다른 글
C++ 알고리즘 - 백준 10250 ACM 호텔 (0) | 2024.12.14 |
---|---|
C++ 알고리즘 - 백준 2884 알람 시계 (0) | 2024.12.14 |
C++ 알고리즘 - 백준 10951 A+B - 4 (0) | 2024.12.14 |
C++ 알고리즘 - 백준 2741 N 찍기 (0) | 2024.12.14 |
C++ 알고리즘 - 백준 8958 OX퀴즈 (0) | 2024.12.14 |