結果
問題 | No.701 ひとりしりとり |
ユーザー |
![]() |
提出日時 | 2018-06-20 16:05:14 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 145 ms / 2,000 ms |
コード長 | 481 bytes |
コンパイル時間 | 1,295 ms |
コンパイル使用メモリ | 159,400 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 17:25:40 |
合計ジャッジ時間 | 2,276 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 12 |
ソースコード
#include <bits/stdc++.h>using namespace std;using i64 = long long;#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)int N;int rec(char c,string s,int cnt){if(cnt == 0){cout << c << s;N--;if(N == 0) cout << 'n' << endl;else cout << c << endl;return 0;}for(char a = 'a';a <= 'z';a++){s.push_back(a);rec(c,s,cnt - 1);s.pop_back();if(N == 0) return 0;}return 0;}int main(){cin >> N;rec('a',string(),18);}