[Bronze / 31403] $A + B - C$
🔷 분류
사칙연산, 수학, 문자열
✒️ 문제 설명
JavaScript에서
를 각각 수와 문자열로 생각했을 때
⬅️ 입력
첫 줄에는 정수
둘째 줄에는 정수
셋째 줄에는 정수
주어지는 모든 수는
➡️ 출력
첫 줄에는
둘째 줄에는
💻 코드 (C++)
#include <iostream>
#include <string>
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int a, b, c;
cin >> a >> b >> c;
int sum1 = a + b - c;
string str = to_string(a) + to_string(b);
int sum2 = stoi(str) - c;
cout << sum1 << "\n" << sum2;
return 0;
}
공유하기
Twitter Facebook LinkedIn글 이동
Comments