結果

問題 No.423 ハムスター語初級(数詞)
ユーザー Yug_min_nullYug_min_null
提出日時 2021-09-14 00:10:30
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 807 bytes
コンパイル時間 1,988 ms
コンパイル使用メモリ 189,064 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-08 08:41:43
合計ジャッジ時間 2,798 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 4 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 WA -
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _GLIBCXX_DEBUG
#define ll long long
#include <bits/stdc++.h>
using namespace std;

int main() {
  string S; cin >> S;
  string T = "";
  while((int)S.size() != 0){
    if((int)S.size() == 3){
      T += "0";
      S = "";
    }else{
      if(S.substr(0, 4) == "hamu"){
        T += "1";
        string U = S.substr(4, (int)S.size());
        S = U;
      }else{
        T += "0";
        string U = S.substr(3, (int)S.size());
        S = U;
      }
    }
  }
  int X = 0;
  reverse(T.begin(), T.end());
  for(int i = 0; i < (int)T.size(); i++){
    if(T[i] == '1'){
      int U = (int)pow(2, i);
      X += U;
    }
  }
  X *= 2;
  string ans = "";
  while(X != 0){
    if(X%2 == 0) ans += "mah";
    else ans += "umah";
    X /= 2;
  }
  reverse(ans.begin(), ans.end());
  cout << ans << endl;
}

0