結果
問題 | No.254 文字列の構成 |
ユーザー |
![]() |
提出日時 | 2015-10-11 11:05:24 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 440 bytes |
コンパイル時間 | 2,411 ms |
コンパイル使用メモリ | 159,584 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-21 06:22:55 |
合計ジャッジ時間 | 3,524 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
#include "bits/stdc++.h"using namespace std;#define REP(i, n) for(int i=0; i<(n); i++)int N;signed main(){cin >> N;int remain = N;string ans = "";char c = 'a';while(remain) {int add = (int)sqrt(remain);REP(i,add*2-1) {ans += (i%2) ? c+1 : c;}c += 2;if (c >= 'y') c = 'a';remain -= pow(add, 2);}cout << ans << endl;return 0;}