結果

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

ソースコード

diff #

#include <iostream>
#include <string> 
#include <algorithm>

using namespace std;
int main(void){
    // Your code here!
    string N;
    cin >> N;
    
    reverse(N.begin(),N.end());
    
    string S = "";
    for(int i = 0; i < N.size(); i++){
        S.push_back(N[i]);
        if(i%3 == 2 and i != N.size() - 1){
            S.push_back(',');
        }
    }
    
    for(auto itr = S.rbegin(); itr != S.rend(); itr++){
        cout << *itr;
    }
    cout << endl;
}
0