結果

問題 No.544 Delete 7
ユーザー YamaKasaYamaKasa
提出日時 2018-09-24 17:47:16
言語 Java21
(openjdk 21)
結果
AC  
実行時間 171 ms / 1,000 ms
コード長 738 bytes
コンパイル時間 3,937 ms
コンパイル使用メモリ 78,296 KB
実行使用メモリ 58,392 KB
最終ジャッジ日時 2023-10-23 18:50:06
合計ジャッジ時間 14,887 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 164 ms
58,156 KB
testcase_01 AC 165 ms
58,152 KB
testcase_02 AC 164 ms
58,380 KB
testcase_03 AC 163 ms
58,324 KB
testcase_04 AC 167 ms
58,344 KB
testcase_05 AC 164 ms
58,352 KB
testcase_06 AC 166 ms
58,380 KB
testcase_07 AC 166 ms
58,328 KB
testcase_08 AC 166 ms
58,152 KB
testcase_09 AC 167 ms
58,176 KB
testcase_10 AC 164 ms
58,328 KB
testcase_11 AC 166 ms
58,360 KB
testcase_12 AC 169 ms
58,144 KB
testcase_13 AC 165 ms
58,144 KB
testcase_14 AC 165 ms
58,232 KB
testcase_15 AC 166 ms
58,128 KB
testcase_16 AC 165 ms
58,332 KB
testcase_17 AC 165 ms
58,212 KB
testcase_18 AC 164 ms
58,172 KB
testcase_19 AC 166 ms
58,180 KB
testcase_20 AC 165 ms
58,236 KB
testcase_21 AC 167 ms
58,364 KB
testcase_22 AC 165 ms
58,176 KB
testcase_23 AC 166 ms
58,212 KB
testcase_24 AC 166 ms
58,348 KB
testcase_25 AC 167 ms
58,336 KB
testcase_26 AC 164 ms
58,276 KB
testcase_27 AC 164 ms
58,352 KB
testcase_28 AC 167 ms
56,108 KB
testcase_29 AC 168 ms
58,324 KB
testcase_30 AC 166 ms
58,152 KB
testcase_31 AC 167 ms
58,284 KB
testcase_32 AC 167 ms
58,240 KB
testcase_33 AC 166 ms
58,392 KB
testcase_34 AC 166 ms
58,260 KB
testcase_35 AC 167 ms
58,296 KB
testcase_36 AC 166 ms
58,312 KB
testcase_37 AC 168 ms
58,124 KB
testcase_38 AC 164 ms
58,188 KB
testcase_39 AC 165 ms
58,076 KB
testcase_40 AC 165 ms
58,336 KB
testcase_41 AC 165 ms
58,096 KB
testcase_42 AC 165 ms
58,280 KB
testcase_43 AC 165 ms
58,184 KB
testcase_44 AC 168 ms
58,084 KB
testcase_45 AC 169 ms
58,120 KB
testcase_46 AC 169 ms
58,100 KB
testcase_47 AC 171 ms
58,208 KB
testcase_48 AC 168 ms
58,124 KB
testcase_49 AC 168 ms
56,268 KB
testcase_50 AC 167 ms
58,124 KB
testcase_51 AC 165 ms
58,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		String N = scan.next();
		scan.close();
		StringBuilder A = new StringBuilder();
		StringBuilder B = new StringBuilder();
		for(int i = 0; i < N.length(); i++) {
			char c = N.charAt(i);
			int k = Character.getNumericValue(c);
			if(k == 7) {
				A.append(3);
				B.append(4);
			}else {
				if(k % 2 == 0) {
					int t = k / 2;
					A.append(t);
					B.append(t);
				}else {
					int t = k / 2;
					A.append(t + 1);
					if(!(B.length() == 0 && t == 0)) {
						B.append(t);
					}
				}
			}
		}
		if(B.length() == 0) {
			B.append(0);
		}
		System.out.println(A.toString() + " " + B.toString());
	}
}
0