結果

問題 No.423 ハムスター語初級(数詞)
ユーザー moyashi_senpaimoyashi_senpai
提出日時 2016-09-22 22:48:47
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,057 bytes
コンパイル時間 1,652 ms
コンパイル使用メモリ 86,828 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-11 02:43:36
合計ジャッジ時間 1,608 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <bitset>
#include <stack>
#include <cstdlib>
#include <unordered_map>
#define REP(i,n) for(int i = 0; n > i; i++)
#define MOD 1000000007
#define Range(x,a,b) ((a) <= (x) && (x) <= (b))
#define POWT(x) ((x)*(x))
using namespace std;
typedef vector<int> Ivec;
typedef pair<int, int> pii;
typedef long long int ll;


int main() {
	char str[51];
	scanf("%s",str);
	int num = 0;
	int cou = 0;
	for(int i = 3; strlen(str) >= i; i+=4) {
		if (str[i] == 'h'){
			i--;
		}
		cou++;
	}
	int c = 0;
	for (int i = 3; strlen(str) > i; i += 4) {
		if (str[i] == 'u') {
			num |= 1 << cou-c-1;
		}
		else {
			i--;
		}
		c++;
	}
	num *= 2;
	string ans;
	while (num) {
		if (num & 1) {
			ans =  "hamu" + ans;
		}
		else
			ans = "ham" + ans;
		num >>= 1;
	}
	if (ans == "") printf("ham\n");
	cout << ans << endl;
	return 0;
}
0