結果
問題 | No.254 文字列の構成 |
ユーザー | Kiona1018 |
提出日時 | 2019-09-26 00:48:43 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 971 bytes |
コンパイル時間 | 2,021 ms |
コンパイル使用メモリ | 170,264 KB |
実行使用メモリ | 4,372 KB |
最終ジャッジ日時 | 2023-10-24 05:29:27 |
合計ジャッジ時間 | 8,069 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,348 KB |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | WA | - |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
ソースコード
#include<bits/stdc++.h> #define rep(i,n,m) for(int i = (n); i <(m); i++) #define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--) using namespace std; using ll = long long; const int MAXS = 100000; vector<ll> triangle; void init() { triangle.assign(MAXS, 0); rep(i, 0, MAXS) triangle[i] = (ll)i * (i+1) / 2; } int main() { init(); ll n; cin >> n; if (n == 2 or n == 4) { cout << "maguro" << endl; return 0; } vector<ll>::iterator itr = upper_bound(triangle.begin(), triangle.end(), n); --itr; int num_a = itr - triangle.begin(); int num_other = n - *itr; // cout << num_as << ' ' << num_other << endl; if (num_other % 2 == 1) { --itr; num_a = itr - triangle.begin(); num_other = n - *itr; } rep(i, 0, num_a) printf("a"); while (num_other > 0) { printf("%c", 'b' + num_other%25); num_other -= 2; } cout << endl; return 0; }