結果
問題 |
No.544 Delete 7
|
ユーザー |
![]() |
提出日時 | 2017-07-15 00:48:30 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 743 bytes |
コンパイル時間 | 629 ms |
コンパイル使用メモリ | 57,628 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-08 00:26:43 |
合計ジャッジ時間 | 2,701 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 44 WA * 4 |
ソースコード
#include<iostream> #include<string> using namespace std; int tene(int n) { int ans=1; for (int i = 0; i <= n - 1; i++) ans = ans * 10; return ans; } int main() { int N, plu=0, leng; string str; int bi=1, tui; cin >> N; str = to_string(N); leng = str.length(); if (str[leng - 1] == '3') { plu++; N++; } str = to_string(N); leng = str.length(); for (int i = 0;i <= leng - 1;i++) { if (str[i] == '2' && str[i + 1] != '0') { plu += tene(leng - i - 1); N += tene(leng - i - 1); } else if (str[i] == '3' && str[i + 1] == '0') { plu += tene(leng - i - 1); N += tene(leng - i - 1); } } leng = str.length(); bi = tene(leng); tui = -(bi - N); cout << bi - plu << " " << tui << endl; return 0; }