結果

問題 No.423 ハムスター語初級(数詞)
ユーザー moyashi_senpaimoyashi_senpai
提出日時 2016-09-22 22:46:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,056 bytes
コンパイル時間 733 ms
コンパイル使用メモリ 86,212 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 19:49:08
合計ジャッジ時間 1,292 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 WA -
testcase_04 AC 2 ms
5,376 KB
testcase_05 WA -
testcase_06 AC 1 ms
5,376 KB
testcase_07 WA -
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 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 << endl;
	return 0;
}
0