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

목차 테이블

Split

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

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초512 MB14713512292.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

2341

예제 출력 1

23 41

예제 입력 2

238445

예제 출력 2

238 445

출처

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

알고리즘 분류


통과된 코드

이 문제가 브론즈2 ???

#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;
}

댓글 달기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다

위로 스크롤