結果
問題 | No.9006 マルチバイト文字テスト(テスト用) |
ユーザー | 👑 p-adic |
提出日時 | 2022-08-14 17:56:14 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 3,073 bytes |
コンパイル時間 | 1,312 ms |
コンパイル使用メモリ | 141,740 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-01 09:48:46 |
合計ジャッジ時間 | 1,844 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,816 KB |
testcase_01 | AC | 2 ms
6,816 KB |
testcase_02 | AC | 2 ms
6,820 KB |
ソースコード
#include <iostream> #include <list> #include <vector> #include <string> #include <stdio.h> #include <stdint.h> #include <iomanip> using namespace std; using uint = unsigned int; using ll = long long; #define CIN( LL , A ) LL A; cin >> A #define GETLINE( A ) string A; getline( cin , A ) #define FOR_LL( VAR , INITIAL , FINAL_PLUS_ONE ) for( ll VAR = INITIAL ; VAR < FINAL_PLUS_ONE ; VAR ++ ) #define FOR_ITR( ARRAY , ITR , END ) for( auto ITR = ARRAY .begin() , END = ARRAY .end() ; ITR != END ; ITR ++ ) #define RETURN( LL , ANSWER ) LL answer_for_contest = ( ANSWER ); cout << answer_for_contest << endl; return 0 template <typename T> inline T Distance( const T& a , const T& b ){ return a < b ? b - a : a - b; } int main() { CIN( string , S ); // https://qiita.com/kiseragi/items/a0e07db26351ec2ef67b より文字一覧をコピー&編集 list<string> a = { "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z", "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z", "1","2","3","4","5","6","7","8","9","0", "a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z", "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","0","1","2","3","4","5","6","7","8","9", "あ","い","う","え","お", "か","き","く","け","こ", "さ","し","す","せ","そ", "た","ち","つ","て","と", "な","に","ぬ","ね","の", "は","ひ","ふ","へ","ほ", "ま","み","む","め","も", "や","ゆ","よ", "ら","り","る","れ","ろ", "わ","ゐ","う","ゑ","を","ん", "ゔ", "が","ぎ","ぐ","げ","ご", "ざ","じ","ず","ぜ","ぞ", "だ","ぢ","づ","で","ど", "ば","び","ぶ","べ","ぼ", "ぱ","ぴ","ぷ","ぺ","ぽ", "ぁ","ぃ","ぅ","ぇ","ぉ", "っ", "ゃ","ゅ","ょ", "ゎ", "ア","イ","ウ","エ","オ", "カ","キ","ク","ケ","コ", "サ","シ","ス","セ","ソ", "タ","チ","ツ","テ","ト", "ナ","ニ","ヌ","ネ","ノ", "ハ","ヒ","フ","ヘ","ホ", "マ","ミ","ム","メ","モ", "ヤ","ユ","ヨ", "ラ","リ","ル","レ","ロ", "ワ","ヰ","ウ","ヱ","ヲ","ン", "ヴ", "ガ","ギ","グ","ゲ","ゴ", "ザ","ジ","ズ","ゼ","ゾ", "ダ","ヂ","ヅ","デ","ド", "バ","ビ","ブ","ベ","ボ", "ヷ","ヸ","ヹ","ヺ", "パ","ピ","プ","ペ","ポ", "ァ","ィ","ゥ","ェ","ォ", "ヵ","ㇰ","ヶ", "ㇱ","ㇲ", "ッ","ㇳ", "ㇴ", "ㇵ","ㇶ","ㇷ","ㇸ","ㇹ", "ㇺ", "ャ","ュ","ョ", "ㇻ","ㇼ","ㇽ","ㇾ","ㇿ", "ヮ" }; string answer = ""; ll size_S = S.size(); while( size_S != 0 ){ FOR_ITR( a , itr , end ){ const ll size_c = itr->size(); if( size_c <= size_S ){ if( S.substr( 0 , size_c ) == *itr ){ answer = *itr + answer; S = S.substr( size_c ); size_S = S.size(); itr = end; itr--; } } } } RETURN( string , answer ); }