結果
問題 | No.784 「,(カンマ)」 |
ユーザー |
![]() |
提出日時 | 2019-02-08 21:31:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 733 bytes |
コンパイル時間 | 674 ms |
コンパイル使用メモリ | 92,984 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 18:29:26 |
合計ジャッジ時間 | 1,205 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <iostream> #include <cstdio> #include <cstring> #include <string> #include <vector> #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <vector> #include <algorithm> #include <cmath> #include <numeric> #include <cassert> #include <memory> #include <stack> #include <set> #include <map> #define INF 1000000000 #define MOD 1000000007 typedef long long ll; typedef unsigned long long ull; using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); string n; cin>>n; string s; int j = 0; for(int i = n.size() - 1; i >= 0; i--) { if (j % 3 == 0 && j != 0) { s += ','; } s += n[i]; j++; } reverse(s.begin(),s.end()); cout << s << endl; }