結果

問題 No.423 ハムスター語初級(数詞)
ユーザー moyashi_senpaimoyashi_senpai
提出日時 2016-09-22 22:45:49
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,048 bytes
コンパイル時間 753 ms
コンパイル使用メモリ 86,272 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-28 19:48:54
合計ジャッジ時間 1,265 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 WA -
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 WA -
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:30:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   30 |         scanf("%s",str);
      |         ~~~~~^~~~~~~~~~

ソースコード

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;
	return 0;
}
0