結果
問題 | No.784 「,(カンマ)」 |
ユーザー |
![]() |
提出日時 | 2022-08-06 00:08:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 616 bytes |
コンパイル時間 | 658 ms |
コンパイル使用メモリ | 74,776 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-15 22:05:25 |
合計ジャッジ時間 | 1,400 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge6 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include<iostream> #include<string> #include<vector> #include<algorithm> #include<map> #define all(x) x.begin(),x.end() #define pb push_back #define ll long long #define P pair<int,int> #define LP pair<ll,ll> using namespace std; int main() { int a; string n; cin >> n; a = n.length(); for(int i =0; i <a; i++) { if (a % 3 == 0) { cout << n[i]; if (i % 3 == 2 and i != a - 1) cout << ','; } else if(a%3==1) { cout << n[i]; if (i % 3 == 0 and i != a - 1) cout << ','; } else { cout << n[i]; if (i % 3 == 1 and i != a - 1) cout << ','; } } cout << endl; return 0; }