結果

問題 No.111 あばばばば
ユーザー HEGO55HEGO55
提出日時 2017-05-17 15:31:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 523 ms / 5,000 ms
コード長 327 bytes
コンパイル時間 2,041 ms
コンパイル使用メモリ 74,164 KB
実行使用メモリ 57,704 KB
最終ジャッジ日時 2023-10-17 23:53:32
合計ジャッジ時間 4,674 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,268 KB
testcase_01 AC 131 ms
57,652 KB
testcase_02 AC 134 ms
57,516 KB
testcase_03 AC 523 ms
57,620 KB
testcase_04 AC 133 ms
57,476 KB
testcase_05 AC 139 ms
57,588 KB
testcase_06 AC 138 ms
57,688 KB
testcase_07 AC 174 ms
57,704 KB
testcase_08 AC 315 ms
57,160 KB
testcase_09 AC 130 ms
57,428 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int W = N;
		long sum = 0;
		int i = 1;
		int j = 0;
		while(N>=3){
			N -= 2;
			sum += i;
			i++;
		}
		
		while(W>=3){
			W -= 2;
			sum += j;
			j++;
		}
		System.out.println(sum);
	}
}
0