結果

問題 No.9006 マルチバイト文字テスト(テスト用)
ユーザー 西尾西尾
提出日時 2018-03-06 16:10:02
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 645 bytes
コンパイル時間 1,707 ms
コンパイル使用メモリ 167,312 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 11:42:10
合計ジャッジ時間 2,296 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

bool bChkMB( const char C )
{
	if( C >= '0' && C <= '9' )
		return false;
	else if( C >= 'a' && C <= 'z' )
		return false;
	else if( C >= 'A' && C <= 'Z' )
		return false;
	else
		return true;
}

int main()
{
int i;
int iPos;
char C;
char S[ 1000 ];
char T[ 1000 ];

	cin >> S;

	i = 0;
	iPos = 500;
	T[ iPos ] = '\0';
	while( ( C = S[ i ] ) != '\0' )
	{
		if( bChkMB( C ) )
		{
			iPos -= 3;
			T[ iPos ]		= C;
			T[ iPos + 1 ]	= S[ i + 1 ];
			T[ iPos + 2 ]	= S[ i + 2 ];
			i += 3;
		}
		else
		{
			iPos--;
			T[ iPos ] = C;
			i++;
		}
	}

	cout << (char*) ( T + iPos ) << endl;

	return 0;
}
0