結果

問題 No.544 Delete 7
ユーザー tetsu
提出日時 2017-11-10 00:48:45
言語 Java
(openjdk 23)
結果
AC  
実行時間 167 ms / 1,000 ms
コード長 587 bytes
コンパイル時間 4,309 ms
コンパイル使用メモリ 81,516 KB
実行使用メモリ 57,000 KB
最終ジャッジ日時 2024-11-21 16:41:11
合計ジャッジ時間 14,100 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 48
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;
import java.util.*;

public class P544 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int copy = N;
		int ketasuu = 0;
		while(copy!=0) {
			copy /=10;
			ketasuu++;
		}
		copy = N;
		ArrayList<Integer> l = new ArrayList<>();
		for(int i=0; i<ketasuu; i++) {
			if(copy%10==7) {
				l.add(1);
			} else {
				l.add(0);
			}
			copy/=10;
		}
		int A = 0;
		Collections.reverse(l);
		for(int x : l) {
			A*= 10;
			A+=x;
		}
		System.out.println(A + " " + (N-A));
	}

}
0