結果

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

ソースコード

diff #

import java.io.*;
import java.util.*;


public class Main_yukicoder544 {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		char[] n = sc.next().toCharArray();
		int m = n.length;

		char[] a = n.clone();
		char[] b = new char[m];
		Arrays.fill(b, '0');

		for (int i = 0; i < m; i++) {
			if (a[i] == '7') {
				a[i]++;
				b[i] = '1';
			}
		}

		int aa = Integer.parseInt(new String(a));
		int bb = Integer.parseInt(new String(b));

		pr.printf("%d %d\n", aa, -bb);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);

		solve();

		pr.close();
		sc.close();
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0