結果
| 問題 |
No.254 文字列の構成
|
| コンテスト | |
| ユーザー |
Kiona1018
|
| 提出日時 | 2019-09-26 00:48:43 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 971 bytes |
| コンパイル時間 | 1,727 ms |
| コンパイル使用メモリ | 171,000 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-22 22:21:24 |
| 合計ジャッジ時間 | 6,438 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 1 |
| other | WA * 30 |
ソースコード
#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;
}
Kiona1018