結果

問題 No.784 「,(カンマ)」
ユーザー minimamu21
提出日時 2020-03-29 16:54:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 1,599 ms
コンパイル使用メモリ 161,840 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-01-02 15:23:00
合計ジャッジ時間 2,494 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    string s;
    cin>>s;
    int sl=s.length();
    string ans;
    rep(i,sl){
        ans+=s[i];
        if((i+1)%3==sl%3&&sl!=(i+1)){
            ans+=',';
        }
    }
    cout<<ans<<endl;
}
0