結果

問題 No.111 あばばばば
ユーザー mitsuomitsuo
提出日時 2016-05-05 10:48:03
言語 Java21
(openjdk 21)
結果
AC  
実行時間 555 ms / 5,000 ms
コード長 702 bytes
コンパイル時間 2,651 ms
コンパイル使用メモリ 75,820 KB
実行使用メモリ 54,332 KB
最終ジャッジ日時 2024-04-15 13:05:58
合計ジャッジ時間 5,647 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 155 ms
54,332 KB
testcase_01 AC 149 ms
41,260 KB
testcase_02 AC 163 ms
41,656 KB
testcase_03 AC 555 ms
41,316 KB
testcase_04 AC 151 ms
41,320 KB
testcase_05 AC 156 ms
41,444 KB
testcase_06 AC 154 ms
41,432 KB
testcase_07 AC 199 ms
41,048 KB
testcase_08 AC 339 ms
41,700 KB
testcase_09 AC 157 ms
41,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package jp.fedom.challange.yuki.q111;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static final double R2 = Math.pow(2, 0.5);

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		List<String> input = new ArrayList<>();
		while (sc.hasNext()) {
			input.add(sc.nextLine());
		}

		System.out.println(solve(input));

		sc.close();
	}

	public static long solve(List<String> in) {
		long L = Long.valueOf(in.get(0).split(" ")[0]);
		long ans = 0;
		for (long l = 3; l <= L; l += 2) {
			if (l == 3) {
				ans += 1;
			} else if (l == 5) {
				ans += 3;
			} else {
				ans += l - 2;
			}
		}
		return ans;
	}

}
0