結果

問題 No.648  お や す み 
ユーザー tetsutetsu
提出日時 2018-02-09 23:06:13
言語 Java21
(openjdk 21)
結果
AC  
実行時間 136 ms / 2,000 ms
コード長 459 bytes
コンパイル時間 4,531 ms
コンパイル使用メモリ 72,288 KB
実行使用メモリ 57,964 KB
最終ジャッジ日時 2023-10-11 22:10:30
合計ジャッジ時間 17,588 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
53,796 KB
testcase_01 AC 125 ms
55,660 KB
testcase_02 AC 126 ms
55,988 KB
testcase_03 AC 126 ms
55,532 KB
testcase_04 AC 125 ms
55,720 KB
testcase_05 AC 126 ms
55,492 KB
testcase_06 AC 123 ms
55,688 KB
testcase_07 AC 122 ms
55,892 KB
testcase_08 AC 124 ms
55,744 KB
testcase_09 AC 126 ms
55,584 KB
testcase_10 AC 124 ms
55,716 KB
testcase_11 AC 124 ms
57,964 KB
testcase_12 AC 122 ms
53,480 KB
testcase_13 AC 124 ms
55,576 KB
testcase_14 AC 124 ms
55,692 KB
testcase_15 AC 125 ms
55,828 KB
testcase_16 AC 123 ms
55,552 KB
testcase_17 AC 123 ms
55,852 KB
testcase_18 AC 121 ms
55,720 KB
testcase_19 AC 121 ms
56,140 KB
testcase_20 AC 124 ms
55,880 KB
testcase_21 AC 121 ms
56,164 KB
testcase_22 AC 123 ms
55,708 KB
testcase_23 AC 124 ms
55,668 KB
testcase_24 AC 121 ms
55,916 KB
testcase_25 AC 122 ms
55,536 KB
testcase_26 AC 124 ms
56,036 KB
testcase_27 AC 126 ms
55,584 KB
testcase_28 AC 125 ms
55,356 KB
testcase_29 AC 124 ms
55,928 KB
testcase_30 AC 123 ms
55,588 KB
testcase_31 AC 129 ms
55,576 KB
testcase_32 AC 127 ms
55,664 KB
testcase_33 AC 126 ms
55,752 KB
testcase_34 AC 126 ms
55,840 KB
testcase_35 AC 136 ms
55,412 KB
testcase_36 AC 125 ms
55,724 KB
testcase_37 AC 123 ms
55,516 KB
testcase_38 AC 123 ms
55,532 KB
testcase_39 AC 124 ms
55,688 KB
testcase_40 AC 125 ms
55,852 KB
testcase_41 AC 126 ms
55,688 KB
testcase_42 AC 127 ms
55,784 KB
testcase_43 AC 127 ms
55,476 KB
testcase_44 AC 126 ms
55,736 KB
testcase_45 AC 126 ms
55,772 KB
testcase_46 AC 126 ms
55,916 KB
testcase_47 AC 125 ms
55,724 KB
testcase_48 AC 127 ms
55,520 KB
testcase_49 AC 125 ms
55,340 KB
testcase_50 AC 126 ms
55,584 KB
testcase_51 AC 127 ms
55,536 KB
testcase_52 AC 127 ms
55,680 KB
testcase_53 AC 126 ms
55,652 KB
testcase_54 AC 126 ms
55,788 KB
testcase_55 AC 128 ms
55,428 KB
testcase_56 AC 127 ms
55,708 KB
testcase_57 AC 125 ms
55,900 KB
testcase_58 AC 126 ms
55,728 KB
testcase_59 AC 127 ms
55,340 KB
testcase_60 AC 127 ms
55,716 KB
testcase_61 AC 126 ms
55,588 KB
testcase_62 AC 124 ms
55,412 KB
testcase_63 AC 126 ms
55,916 KB
testcase_64 AC 125 ms
55,548 KB
testcase_65 AC 124 ms
55,368 KB
testcase_66 AC 124 ms
55,712 KB
testcase_67 AC 127 ms
55,576 KB
testcase_68 AC 125 ms
54,084 KB
testcase_69 AC 124 ms
55,776 KB
testcase_70 AC 124 ms
55,828 KB
testcase_71 AC 125 ms
55,920 KB
testcase_72 AC 127 ms
55,356 KB
testcase_73 AC 124 ms
55,632 KB
testcase_74 AC 126 ms
55,344 KB
testcase_75 AC 124 ms
55,640 KB
testcase_76 AC 127 ms
55,572 KB
testcase_77 AC 127 ms
55,616 KB
testcase_78 AC 125 ms
55,632 KB
testcase_79 AC 125 ms
55,612 KB
testcase_80 AC 123 ms
55,720 KB
testcase_81 AC 124 ms
55,712 KB
testcase_82 AC 125 ms
55,748 KB
testcase_83 AC 126 ms
55,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yuki183;

import java.util.Scanner;

public class C {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		double low = Math.sqrt(2*n)-1;
		double up = Math.sqrt(2*n);
		long init = (long)(low);
		for(long k=init-1; k<up+1; k++) {
			if(k*(k+1)==2*n) {
				System.out.println("YES"); System.out.println(k); return;
			}
		}
		System.out.println("NO");
	}
}
0