結果

問題 No.83 最大マッチング
ユーザー jimanojimano
提出日時 2017-05-07 17:28:01
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 672 bytes
コンパイル時間 2,046 ms
コンパイル使用メモリ 71,636 KB
実行使用メモリ 49,732 KB
最終ジャッジ日時 2023-10-12 16:11:28
合計ジャッジ時間 3,894 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 43 ms
49,264 KB
testcase_01 AC 42 ms
49,276 KB
testcase_02 AC 41 ms
49,260 KB
testcase_03 AC 42 ms
49,248 KB
testcase_04 AC 42 ms
49,332 KB
testcase_05 AC 42 ms
49,260 KB
testcase_06 AC 43 ms
49,248 KB
testcase_07 AC 42 ms
49,360 KB
testcase_08 AC 42 ms
49,264 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
権限があれば一括ダウンロードができます

ソースコード

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