結果

問題 No.544 Delete 7
ユーザー tanzaku
提出日時 2017-07-14 22:55:26
言語 Java
(openjdk 23)
結果
AC  
実行時間 162 ms / 1,000 ms
コード長 695 bytes
コンパイル時間 3,440 ms
コンパイル使用メモリ 84,544 KB
実行使用メモリ 55,080 KB
最終ジャッジ日時 2024-11-21 16:11:30
合計ジャッジ時間 13,226 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 48
権限があれば一括ダウンロードができます

ソースコード

diff #


import java.util.*;

public class No543 {

	public static void main(String[] args) {
		try (final Scanner sc = new Scanner(System.in)) {
			int n = sc.nextInt();
			Random random = new Random();
			while (true) {
				int a = random.nextInt(2_000_000_001) - 1_000_000_000;
				int b = n - a;
				if (Math.abs(b) > 1_000_000_000) continue;
				if ((a+"").indexOf('7') < 0 && (b+"").indexOf('7') < 0) {
					System.out.println(a + " " + b);
					break;
				}
			}
		}
	}
	
	static long gcd(long n, long r) { return r == 0 ? n : gcd(r, n % r); }
	static long lcm(long n, long r) { return n/gcd(n,r)*r; }
	static void dump(Object... objects) { System.err.println(Arrays.deepToString(objects)); }
}
0