結果

問題 No.784 「,(カンマ)」
ユーザー ut0s
提出日時 2019-08-27 17:31:21
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 508 bytes
コンパイル時間 1,565 ms
コンパイル使用メモリ 166,680 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-15 22:59:32
合計ジャッジ時間 2,115 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
  @file 784.cpp
  @title  No.784 「,(カンマ)」 - yukicoder
  @url https://yukicoder.me/problems/no/784
**/

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, N) for (int i = 0; i < (N); ++i)

int main() {
  string N;
  cin >> N;

  const int gap = (int)N.size() % 3;
  REP(i, (int)N.size()) {
    if (i != 0 && (i - gap) % 3 == 0) {
      cout << ",";
    }
    cout << N[i] << "";
  }
  cout << "\n";

  return 0;
}
0