結果
問題 | No.784 「,(カンマ)」 |
ユーザー |
![]() |
提出日時 | 2019-03-21 01:53:20 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 389 bytes |
コンパイル時間 | 1,787 ms |
コンパイル使用メモリ | 171,656 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-19 00:56:31 |
合計ジャッジ時間 | 2,443 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; reverse(s.begin(), s.end()); stack<char> stk; for (int i = 0; i < s.length(); ++i) { stk.push(s[i]); if (i % 3 == 2 && i != s.length() - 1) stk.push(','); } while (!stk.empty()) { cout << stk.top(); stk.pop(); } cout << endl; return 0; }