結果
| 問題 | No.600 かい文回 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-11-27 12:30:55 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 586 bytes |
| 記録 | |
| コンパイル時間 | 722 ms |
| コンパイル使用メモリ | 87,232 KB |
| 実行使用メモリ | 9,856 KB |
| 最終ジャッジ日時 | 2026-05-21 17:09:33 |
| 合計ジャッジ時間 | 6,330 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 2 TLE * 1 -- * 18 |
コンパイルメッセージ
main.cpp: In function 'std::string solve(int)':
main.cpp:36:46: warning: ignoring return value of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&) [with _CharT = char; _Traits = char_traits<char>; _Alloc = allocator<char>]', declared with attribute 'nodiscard' [-Wunused-result]
36 | if (n % 2 == 0) foo() + solve(n / 2) + foo();
| ^
In file included from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/string:56,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/locale_classes.h:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ios_base.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ios:46,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/ostream.h:43,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/ostream:42,
from /home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/iostream:43,
from main.cpp:1:
/home/linuxbrew/.linuxbrew/Cellar/gcc/15.2.0_1/include/c++/15/bits/basic_string.h:3938:5: note: declared here
3938 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
| ^~~~~~~~
ソースコード
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;
char pt0 = 'p';
char pt1 = 'q';
void step() {
pt1++;
if (pt1 > 'z') {
pt0++;
pt1 = pt0 + 1;
}
}
string foo() {
string ret;
ret += pt0;
ret += pt1;
return ret;
}
string bar() {
string ret;
ret += pt0;
ret += pt1;
step();
return ret;
}
string solve(int n) {
if (n == 1) return bar();
if (n % 2 == 0) foo() + solve(n / 2) + foo();
string t = bar();
return t + solve(n - 1) + t;
}
int main() {
int n;
cin >> n;
cout << solve(n) << endl;
}