結果
問題 |
No.784 「,(カンマ)」
|
ユーザー |
![]() |
提出日時 | 2019-03-27 20:42:36 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 428 bytes |
コンパイル時間 | 460 ms |
コンパイル使用メモリ | 57,440 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-11 06:13:12 |
合計ジャッジ時間 | 1,077 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 WA * 2 |
ソースコード
#include <iostream> #include <string> #include <algorithm> using namespace std; int main(void){ string a; int ans=0,wow; cin>>a; wow=a.size()%3; for(int i=0;i<wow;i++){ cout<<a[i]; } if(wow!=0){ cout<<','; } for(int i=wow;i<a.size();i++){ cout<<a[i]; ans++; if(ans==3 && i!=a.size()-1){ cout<<','; ans=0; } } }