結果
| 問題 | No.784 「,(カンマ)」 | 
| コンテスト | |
| ユーザー |  trineutron | 
| 提出日時 | 2020-04-09 16:57:10 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 261 bytes | 
| コンパイル時間 | 1,953 ms | 
| コンパイル使用メモリ | 193,724 KB | 
| 最終ジャッジ日時 | 2025-01-09 15:30:14 | 
| ジャッジサーバーID (参考情報) | judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 10 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
    string n;
    cin >> n;
    int d = n.size(), r = (d - 1) % 3 + 1;
    cout << n.substr(0, r);
    for (int i = r; i < d; i += 3) {
        cout << "," << n.substr(i, 3);
    }
    cout << endl;
}
            
            
            
        