結果
問題 |
No.784 「,(カンマ)」
|
ユーザー |
![]() |
提出日時 | 2024-10-06 18:43:50 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 442 bytes |
コンパイル時間 | 929 ms |
コンパイル使用メモリ | 95,852 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-06 18:43:52 |
合計ジャッジ時間 | 1,649 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include<iostream> #include<vector> #include<algorithm> using namespace std; using ll = long long; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); string s; cin>>s; string ans = ""; int cnt = 0; for(int i = s.size()-1;i>=0;i--){ ans = string(1,s[i]) + ans; cnt++; if(cnt==3&&i!=0){ cnt = 0; ans = "," + ans; } } cout<<ans<<endl; }