結果

問題 No.544 Delete 7
ユーザー takiteke
提出日時 2017-07-15 00:13:39
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 599 bytes
コンパイル時間 691 ms
コンパイル使用メモリ 56,280 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-08 00:18:42
合計ジャッジ時間 2,514 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 27 WA * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<string>
using namespace std;

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 += 10;
			N += 10;
		}
		else if (str[i] == 3 && str[i + 1] == 0) {
			plu += 10;
			N += 10;
		}
	}
	
	leng = str.length();

	for(int i=0; i<=leng-1; i++) bi = bi * 10;

	tui = -(bi - N);

	cout << bi - plu << " " << tui << endl;

	return 0;
}
0