[백준] 10824번 :네 수

2021. 1. 19. 22:05Algorithm/백준

 

 

10824번: 네 수

첫째 줄에 네 자연수 A, B, C, D가 주어진다. (1 ≤ A, B, C, D ≤ 1,000,000)

www.acmicpc.net

 

stoll(string s) : string -> long

 

#include <iostream>
#include<vector>
#include<string>
using namespace std;


int main() {

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	string a,b,c,d;
	string ab, cd;

	cin >> a >> b >> c >> d;
	ab += a; ab += b;
	cd += c; cd += d;

	long long sum = stoll(ab) + stoll(cd);
	cout << sum;
	return 0;
}

 

'Algorithm > 백준' 카테고리의 다른 글

[백준] 1707번: 이분 그래프  (0) 2021.01.20
[백준] 11724번: 연결 요소의 개수  (0) 2021.01.20
[백준] 11655번: ROT13  (0) 2021.01.19
[백준] 2743번: 단어 길이 재기  (0) 2021.01.19
[ 백준] 10820번 : 문자열 분석  (0) 2021.01.19