結果

問題 No.83 最大マッチング
ユーザー jimano
提出日時 2017-05-07 17:28:01
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 2,663 ms
コンパイル使用メモリ 73,676 KB
実行使用メモリ 37,092 KB
最終ジャッジ日時 2024-09-14 14:50:07
合計ジャッジ時間 3,564 ms
ジャッジサーバーID
(参考情報)
judge1 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
			int n = Integer.parseInt(br.readLine());
			int sum = 0;

			if (n % 2 == 0) {
				while (n > 0) {
					sum += (int) (1 * Math.pow(10, (n - 1)/ 2));
					n -= 2;
				}
			}
			else {
				sum += (int) (7 * Math.pow(10, (n - 2)/ 2));
				n -= 3;
				while (n > 0) {
					sum += (int) (1 * Math.pow(10, (n - 1)/ 2));
					n -= 2;
				}
			}
			
			System.out.println(sum);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
0