結果

問題 No.83 最大マッチング
ユーザー r.suzuki
提出日時 2016-01-14 23:45:45
言語 Java
(openjdk 23)
結果
AC  
実行時間 132 ms / 5,000 ms
コード長 710 bytes
コンパイル時間 3,407 ms
コンパイル使用メモリ 76,572 KB
実行使用メモリ 54,292 KB
最終ジャッジ日時 2024-09-19 19:05:00
合計ジャッジ時間 5,456 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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