結果

問題 No.544 Delete 7
コンテスト
ユーザー hamray
提出日時 2019-03-21 17:13:27
言語 C++11(old_compat)
(gcc 12.4.0 + boost 1.89.0)
コンパイル:
g++-12 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -include bits/stdc++.h -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 535 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,388 ms
コンパイル使用メモリ 166,076 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-08 16:19:10
合計ジャッジ時間 2,992 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 48
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;

#define MAXV 1000000000
using ll = long long;
int main() {
	ll N; cin >> N;

	for (ll bit = 0; bit < (1 << 9); ++bit) {
		ll t = 0;
		for (int i = 0; i < 10; ++i) {
			if (bit >> i & 1) t += pow(10, i);
		}

		ll a = t, b = abs(N - a);

		bool c = true;
		while (a) {
			if (a % 10 == 7) c = false;
			a /= 10;
		}

		while (b) {
			if (b % 10 == 7) c = false;
			b /= 10;
		}

		if (c) {
			cout << t << " " << N - t << endl;
			return 0;
		} 

	}

	
}
0