結果

問題 No.784 「,(カンマ)」
ユーザー Konton7
提出日時 2020-01-13 18:13:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 328 bytes
コンパイル時間 2,230 ms
コンパイル使用メモリ 168,776 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-21 10:01:41
合計ジャッジ時間 2,426 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main(){
    string s, ans;
    cin >> s;
    int n = s.size();
    int p = n % 3;
    int t = 0;
    for (char c : s){
        if (t % 3 == p && t > 0)
            ans += ',';
        ans += c;
        t ++;
    }
    cout << ans << endl;
    return 0;
}
0