백준 21955번 (Split, C++) [BAEKJOON]

문제

https://www.acmicpc.net/problem/21955

시간 제한 메모리 제한 제출 정답 맞힌 사람 정답 비율
1 초 512 MB 147 135 122 92.424%

In order to teach Mihai to write figures neatly, his teacher gave him for homework to write several numbers.

Because he was rushing to finish his homework as quick as possible so that he can play on the computer,

he wrote the numbers so close that some of them were attached.

When his mother looked on Mihai’s notebook, she noticed this thing and she thought of a challenge for the little boy.

She writes a number with an even number of digits and Mihai should split this number in two equal parts and should write the two numbers which are formed after this move.

This thing will help Mihai learn how to write numbers neatly in a funny way.

Help Mihai find two numbers which form the number said by his mother, if we attach the second number at the end of the first one.

입력

The first line of the input contains only one integer, N – the number told by Mihai’s mother.

출력

The output contains two integers separated by space, the numbers which form the number told by Mihai’s mother.

제한

  • 1 ≤ N ≤ 1018.
  • N has even number of digits.
  • All digits are different from 0.

예제 입력 1

plaintext
2341

예제 출력 1

plaintext
23 41

예제 입력 2

plaintext
238445

예제 출력 2

plaintext
238 445

알고리즘 분류

출처

Contest > infO(1) Cup > infO(1) Cup 2019 National Round 1번


접근 방법

이 문제가 브론즈2 ???

통과된 코드

cpp
#include <iostream>
#include <string>
using namespace std;
string str;
int main()
{
	cin >> str;
	int _Pivot = str.length() * 0.5f;
	cout << str.substr(0, _Pivot) << " " << str.substr(_Pivot, str.length());
	return 0;
}