結果

問題 No.784 「,(カンマ)」
ユーザー ミドリムシミドリムシ
提出日時 2019-02-08 22:07:39
言語 C++11
(gcc 8.5.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 352 bytes
コンパイル時間 390 ms
使用メモリ 6,948 KB
最終ジャッジ日時 2023-02-01 16:42:37
合計ジャッジ時間 1,531 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
6,948 KB
testcase_01 AC 1 ms
6,948 KB
testcase_02 AC 2 ms
6,948 KB
testcase_03 AC 2 ms
4,904 KB
testcase_04 AC 2 ms
4,904 KB
testcase_05 AC 2 ms
4,900 KB
testcase_06 AC 1 ms
4,900 KB
testcase_07 AC 1 ms
4,904 KB
testcase_08 AC 2 ms
4,904 KB
testcase_09 AC 1 ms
4,904 KB
testcase_10 AC 1 ms
6,948 KB
testcase_11 AC 1 ms
6,948 KB
testcase_12 AC 2 ms
4,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
#define all(x) (x).begin(), (x).end()

int main(){
    string N;
    cin >> N;
    int sz = int(N.size());
    for(int i = sz - 1; i >= 1; i--){
        if(i % 3 == sz % 3){
            N.insert(N.begin() + i, ',');
        }
    }
    cout << N << endl;
}
0