結果

問題 No.544 Delete 7
ユーザー sora410_t
提出日時 2017-11-03 09:34:29
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 419 bytes
コンパイル時間 451 ms
コンパイル使用メモリ 58,976 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-11-22 15:18:38
合計ジャッジ時間 13,179 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 44 TLE * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:29: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |         cout << a << " " << b << endl;
      |                             ^
main.cpp:23:22: warning: ‘a’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |         cout << a << " " << b << endl;
      |                      ^~~

ソースコード

diff #

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

bool have7(const int n) noexcept {
	int r = n;
	for (int i = 0; i < log10(n); ++i) {
		if (r % 10 == 7) { return true; }
		r = floor(r / 10);
	}
	return false;
} 

int main() {
	int n, a, b;
	cin >> n;
	for (int i = 1; i < n; ++i) {
		if (have7(i)) { continue; }
		if (have7(n-i)) { continue; }
		a = i; b = n - i;
		break;
	}
	cout << a << " " << b << endl;
}
0