結果
| 問題 |
No.423 ハムスター語初級(数詞)
|
| コンテスト | |
| ユーザー |
aaa
|
| 提出日時 | 2018-10-29 20:18:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,246 bytes |
| コンパイル時間 | 890 ms |
| コンパイル使用メモリ | 95,956 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-19 08:10:17 |
| 合計ジャッジ時間 | 1,545 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 8 WA * 1 |
ソースコード
#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>
#include <sstream>
using namespace std;
int main(){
int i, j;
string s;
cin >> s;
string s1;
while (true)
{
for (i = 0; i < 3; i++) {
s.erase(s.begin());
}
if (s.length() <= 0) {
s1 += '0';
break;
}
if (s[0] == 'u') {
s1 += '1';
s.erase(s.begin());
}
else {
s1 += '0';
}
if (s.length() <= 0) {
break;
}
}
int num = 0, kis = 1;
for (i = s1.length() - 1; i >= 0; i--) {
num += ((int)s1[i] - 48) * kis;
kis *= 2;
}
num *= 2;
bitset<40>bb(num);
string s2 = bb.to_string();
//cout << "num->" << num << endl;
//cout << "s2->" << s2 << endl;
int len = s2.length();
for (i = 0; i < len; i++) {
if (s2[0] == '0') {
s2.erase(s2.begin());
}
else {
break;
}
}
string s3;
for (i = 0; i < s2.length(); i++) {
if (s2[i] == '1') {
s3 += "hamu";
}
else {
s3 += "ham";
}
}
cout << s3 << endl;
getchar();
getchar();
return 0;
}
aaa