結果
| 問題 |
No.3274 Arithmetic Right Shift
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-19 22:07:39 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 1,500 ms |
| コード長 | 552 bytes |
| コンパイル時間 | 3,093 ms |
| コンパイル使用メモリ | 279,200 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-09-19 22:07:45 |
| 合計ジャッジ時間 | 3,678 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 |
ソースコード
#include <bits/stdc++.h>
[[nodiscard]] static inline constexpr std::string solve(const uint_fast32_t K, const std::string& S) noexcept
{
if (K >= S.size())
return std::string(S.size(), S.front());
else
return std::string(K, S.front()) + S.substr(0, S.size() - K);
}
int main()
{
std::cin.tie(nullptr);
std::ios::sync_with_stdio(false);
uint_fast32_t T;
std::cin >> T;
for (uint_fast32_t i = 0; i < T; ++i)
{
uint_fast32_t K;
std::string S;
S.reserve(64);
std::cin >> K >> S;
std::cout << solve(K, S) << '\n';
}
return 0;
}