結果
問題 | No.784 「,(カンマ)」 |
ユーザー |
![]() |
提出日時 | 2020-03-30 21:39:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 353 bytes |
コンパイル時間 | 1,907 ms |
コンパイル使用メモリ | 167,684 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-23 04:01:35 |
合計ジャッジ時間 | 2,630 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; const int n = s.length(); reverse(s.begin(), s.end()); string t = ""; for (int i = 0; i < n; i++) { t += s[i]; if (i % 3 == 2 and i + 1 < n) t += ","; } reverse(t.begin(), t.end()); cout << t << endl; return 0; }