結果

問題 No.1256 連続整数列
ユーザー キョウチクキョウチク
提出日時 2022-05-15 20:50:39
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 447 bytes
コンパイル時間 4,349 ms
コンパイル使用メモリ 73,224 KB
実行使用メモリ 58,208 KB
最終ジャッジ日時 2023-10-11 09:13:14
合計ジャッジ時間 8,866 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
55,612 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 117 ms
55,736 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 119 ms
56,144 KB
testcase_07 AC 115 ms
55,916 KB
testcase_08 AC 119 ms
55,832 KB
testcase_09 AC 117 ms
56,184 KB
testcase_10 AC 113 ms
55,996 KB
testcase_11 AC 118 ms
56,108 KB
testcase_12 AC 118 ms
55,872 KB
testcase_13 AC 116 ms
55,848 KB
testcase_14 AC 120 ms
56,132 KB
testcase_15 AC 115 ms
56,088 KB
testcase_16 AC 117 ms
55,752 KB
testcase_17 AC 113 ms
56,060 KB
testcase_18 AC 120 ms
55,664 KB
testcase_19 AC 117 ms
56,164 KB
testcase_20 AC 118 ms
56,016 KB
testcase_21 AC 120 ms
55,980 KB
testcase_22 AC 116 ms
56,308 KB
testcase_23 AC 115 ms
55,800 KB
testcase_24 AC 116 ms
56,408 KB
testcase_25 AC 116 ms
56,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
public class Test10 {
  public static void main(String[] args){
    Scanner sc=new Scanner(System.in);
    String line;
    line=sc.nextLine();
    int a=Integer.parseInt(line),n=1+2;
    String result="NO";
    for(int i=3;result.equals("NO");i++){
      n+=i;
      if(a<n){
        break;
      }
      if((a-n)%i==0){
        result="YES";
        break;
      }
    }
    System.out.println(result);
    sc.close();
  }
}
0