結果
| 問題 |
No.423 ハムスター語初級(数詞)
|
| コンテスト | |
| ユーザー |
moyashi_senpai
|
| 提出日時 | 2016-09-22 22:45:49 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,048 bytes |
| コンパイル時間 | 912 ms |
| コンパイル使用メモリ | 87,332 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-17 14:59:12 |
| 合計ジャッジ時間 | 1,280 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 WA * 2 |
コンパイルメッセージ
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);
| ~~~~~^~~~~~~~~~
ソースコード
#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;
}
moyashi_senpai