結果

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

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int main() {
  string N, t;
  cin >> N;
  reverse(N.begin(), N.end());
  for (size_t i = 0, j = 0; i < N.length(); ) {
    if (j == 3) {
      t += ",";
      j = 0;
    } else {
      t += N.substr(i, 1);
      i++;
      j++;
    }

  }
  reverse(t.begin(), t.end());
  cout << t << endl;
}
0