結果

問題 No.111 あばばばば
ユーザー リチウムリチウム
提出日時 2014-12-23 23:54:41
言語 Java19
(openjdk 21)
結果
AC  
実行時間 126 ms / 5,000 ms
コード長 276 bytes
コンパイル時間 6,311 ms
コンパイル使用メモリ 71,608 KB
実行使用メモリ 55,832 KB
最終ジャッジ日時 2023-09-02 22:17:48
合計ジャッジ時間 6,849 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,708 KB
testcase_01 AC 122 ms
55,452 KB
testcase_02 AC 121 ms
55,780 KB
testcase_03 AC 121 ms
55,340 KB
testcase_04 AC 122 ms
55,832 KB
testcase_05 AC 124 ms
55,676 KB
testcase_06 AC 122 ms
55,692 KB
testcase_07 AC 122 ms
55,536 KB
testcase_08 AC 122 ms
55,528 KB
testcase_09 AC 126 ms
55,608 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class LightSwitchingPuzzle {
	
	
	 public static void main(String[] args) {
		 Scanner sc=new Scanner(System.in);
		 long n=sc.nextLong();
		 long N=n/2;
		 long ans=N*(N+1)/2;
		 N=(n-2)/2;
		 ans+=N*(N+1)/2;
		 
		 System.out.println(ans);
	 }


}
0