結果

問題 No.1256 連続整数列
ユーザー xRS43BofaUEZ5gcxRS43BofaUEZ5gc
提出日時 2021-03-11 14:24:29
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 615 bytes
コンパイル時間 3,258 ms
コンパイル使用メモリ 74,960 KB
実行使用メモリ 47,232 KB
最終ジャッジ日時 2024-04-21 04:23:38
合計ジャッジ時間 7,230 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
46,380 KB
testcase_01 WA -
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class HelloWorld {

	    public static void main(String[] args) throws Exception {

	    	Scanner sc = new Scanner(System.in);
	    	int a = sc.nextInt();
	    	sc.close();

	    	boolean flag = false;
	    	for (int i=1; i < a / 3 ; i++) {
	    		int sum_now = 0;
	    		for (int j=i; ;j++) {
	    			if (sum_now > a) {
	    				break;
	    			}
	    			if (sum_now == a) {
	    				flag = true;
	    				break;
	    			}
	    			sum_now += j;
	    		}
	    		if (flag == true) {
	    			break;
	    		}
	    	}

	    	System.out.println(flag ? "YES" : "NO");
	    	}

	    }




0