結果
問題 | No.254 文字列の構成 |
ユーザー | RiRinbaru |
提出日時 | 2024-08-23 08:23:41 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 5,000 ms |
コード長 | 1,178 bytes |
コンパイル時間 | 4,334 ms |
コンパイル使用メモリ | 230,540 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-08-23 08:23:56 |
合計ジャッジ時間 | 6,337 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> #define rep(i, p, n) for (ll i = p; i < (ll)(n); i++) #define rep2(i, p, n) for (ll i = p; i >= (ll)(n); i--) using namespace std; using ll = long long; using ld = long double; const double pi = 3.141592653589793; const long long inf = 2 * 1e9; const long long linf = 4 * 1e18; const ll mod1 = 1000000007; const ll mod2 = 998244353; template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return 1; } return 0;} template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return 1; } return 0; } //atcoder #include <atcoder/all> using namespace atcoder; using mint1 = modint1000000007; using mint2 = modint998244353; vector<pair<ll, ll>> base={{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; int main() { ll N; cin >> N; ll now=0; while(N>0) { ll temp=0; while(true) { if ((temp+2)*(temp+2)>N) { break; } temp++; } char P='a'+(now%13)*2, Q=P+1; cout << P; rep(i, 0, temp) { cout << Q << P; } N-=(temp+1)*(temp+1); now++; } }