結果

問題 No.784 「,(カンマ)」
ユーザー hiyori
提出日時 2019-02-10 16:36:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 322 bytes
コンパイル時間 552 ms
コンパイル使用メモリ 65,736 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-06 12:22:55
合計ジャッジ時間 1,057 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>

using namespace std;

int main()
{
    string str, new_str="";
    cin>>str;
    int cnt=0;
    for(int i=str.length()-1; i>=0; i--){
        new_str = str[i]+new_str;
        cnt++;
        if(cnt%3==0 && i>0){ new_str = ','+new_str; }
    }
    cout<<new_str<<endl;;
    return 0;
}
0