結果

問題 No.111 あばばばば
ユーザー mitsuomitsuo
提出日時 2016-05-05 10:48:03
言語 Java
(openjdk 23)
結果
AC  
実行時間 477 ms / 5,000 ms
コード長 702 bytes
コンパイル時間 1,976 ms
コンパイル使用メモリ 76,040 KB
実行使用メモリ 55,472 KB
最終ジャッジ日時 2024-10-05 09:28:43
合計ジャッジ時間 4,382 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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