結果
問題 |
No.784 「,(カンマ)」
|
ユーザー |
![]() |
提出日時 | 2024-02-09 17:02:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 399 bytes |
コンパイル時間 | 1,918 ms |
コンパイル使用メモリ | 194,240 KB |
最終ジャッジ日時 | 2025-02-19 03:01:48 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios_base::sync_with_stdio(false); string s, t=""; cin >> s; reverse(s.begin(), s.end()); for (int i=1; i<=s.size(); i++){ t += s[i-1]; if (i % 3 == 0 && i != s.size()) t += ','; } reverse(t.begin(), t.end()); cout << t << endl; return 0; }