結果
問題 | No.784 「,(カンマ)」 |
ユーザー |
|
提出日時 | 2021-09-03 20:35:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 342 bytes |
コンパイル時間 | 2,178 ms |
コンパイル使用メモリ | 189,944 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-15 08:02:19 |
合計ジャッジ時間 | 2,977 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#define _GLIBCXX_DEBUG #include <bits/stdc++.h> using namespace std; int main() { string N; cin >> N; int n = (int)N.size(); if(n <= 3){ cout << N << endl; }else{ string ans = ""; for(int i = 0; i < n; i++){ ans += N[i]; if((i+1)%3 == n%3) ans += ","; } ans.pop_back(); cout << ans << endl; } }