結果
問題 | No.544 Delete 7 |
ユーザー |
|
提出日時 | 2019-01-08 21:30:38 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 498 bytes |
コンパイル時間 | 2,089 ms |
コンパイル使用メモリ | 170,964 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-24 00:49:13 |
合計ジャッジ時間 | 3,793 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 48 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; priority_queue<int, vector<int>, greater<int>> que; int n = s.length(); for(int i = 0; i < n; i++) { if(s[i] == '7') que.push(n - 1 - i); } string t; for(int i = 0; i < n; i++) { if(que.empty()) break; if(que.top() == i) { t.insert(0, "1"); que.pop(); } else { t.insert(0, "0"); } } cout << t << " " << stoi(s) - stoi(t) << endl; return 0; }