結果

問題 No.83 最大マッチング
ユーザー r.suzukir.suzuki
提出日時 2016-01-14 23:45:45
言語 Java21
(openjdk 21)
結果
AC  
実行時間 147 ms / 5,000 ms
コード長 710 bytes
コンパイル時間 4,877 ms
コンパイル使用メモリ 76,368 KB
実行使用メモリ 57,700 KB
最終ジャッジ日時 2023-10-19 23:07:59
合計ジャッジ時間 6,764 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
57,672 KB
testcase_01 AC 134 ms
57,496 KB
testcase_02 AC 132 ms
57,264 KB
testcase_03 AC 135 ms
57,628 KB
testcase_04 AC 132 ms
57,264 KB
testcase_05 AC 134 ms
57,636 KB
testcase_06 AC 135 ms
57,204 KB
testcase_07 AC 133 ms
57,532 KB
testcase_08 AC 135 ms
57,420 KB
testcase_09 AC 141 ms
57,544 KB
testcase_10 AC 145 ms
57,700 KB
testcase_11 AC 147 ms
57,668 KB
testcase_12 AC 144 ms
57,512 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

enum Type{
	EVEN,ODD;
}

class Counter{
	int match;
	Type type;
	StringBuilder ans;
	
	public Counter(int i){
		this.match = i;
		if(match%2 == 0)
			this.type = Type.EVEN;
		else
			this.type = Type.ODD;
		ans = new StringBuilder();
	}
	
	public void lineUpOne(){
		for(int i = 0;i < this.match/2;i++){
			this.ans.append('1');
		}
	}
	
	public void changeTheHead(){
		if(this.type.equals(Type.ODD))
			this.ans.setCharAt(0,'7');
	}
}

public class No_83_2{
	public static void main(String[] args){
		java.util.Scanner sc = new java.util.Scanner(System.in);
		
		Counter counter = new Counter(sc.nextInt());
		
		counter.lineUpOne();
		
		counter.changeTheHead();
		
		System.out.println(counter.ans);
		
	}
}
0