結果

問題 No.111 あばばばば
ユーザー kuramukuramu
提出日時 2016-01-22 21:31:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 396 ms / 5,000 ms
コード長 557 bytes
コンパイル時間 2,854 ms
コンパイル使用メモリ 75,572 KB
実行使用メモリ 54,000 KB
最終ジャッジ日時 2023-10-21 13:47:11
合計ジャッジ時間 3,724 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
53,496 KB
testcase_01 AC 47 ms
53,496 KB
testcase_02 AC 50 ms
53,508 KB
testcase_03 AC 396 ms
54,000 KB
testcase_04 AC 47 ms
52,400 KB
testcase_05 AC 59 ms
53,952 KB
testcase_06 AC 62 ms
53,988 KB
testcase_07 AC 96 ms
53,976 KB
testcase_08 AC 222 ms
53,984 KB
testcase_09 AC 47 ms
53,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
	      BufferedReader stdReader =new BufferedReader(new InputStreamReader(System.in));
	      try {
	    	  long N = Long.parseLong(stdReader.readLine());
	    	  long sum = 0;
	    	  long index = 0;
	    	  while(N >=3){
	    		  sum += index*2+1;
	    		  index++;
	    		  N -= 2;
	    	  }
	    	  System.out.println(sum);
	    	  } catch (IOException e) {
			e.printStackTrace();
	      }
	}	
}
0