結果

問題 No.638 Sum of "not power of 2"
ユーザー 37zigen37zigen
提出日時 2018-04-19 23:19:47
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 488 bytes
コンパイル時間 689 ms
コンパイル使用メモリ 26,864 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-09 11:51:06
合計ジャッジ時間 1,542 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

module mdl
contains

    function ispower2(n)
        integer*8,value::n
        logical::ispower2
        do while(mod(n,2)==0.and.n>0)
            n=n/2
        end do
        ispower2=n==1
    end function
end module


program main
    use mdl
    implicit none
    integer*8::n,i
    read*,n
    do i=1,min(n-1,1000000)
        if(.not.ispower2(i).and..not.ispower2(n-i))then
            print"(i0,' ',i0)",i,n-i
            return
        end if
    end do
    print*,-1
end program
0