結果

問題 No.642 Two Operations No.1
ユーザー 37zigen37zigen
提出日時 2018-04-18 21:47:45
言語 Fortran
(gFortran 13.2.0)
結果
WA  
実行時間 -
コード長 353 bytes
コンパイル時間 1,723 ms
コンパイル使用メモリ 25,880 KB
実行使用メモリ 5,200 KB
最終ジャッジ日時 2023-09-09 11:27:10
合計ジャッジ時間 3,543 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

program main
    implicit none
    integer*8::n,i,j,k,ans=0
    read*,n
    i=n
    j=1
    do while(j<n)
        j=j*2
        ans=ans+1
    end do
    n=j-n
    i=n
    if(i>0)then
        do while(i>0)
            ans=ans+1
            if(mod(i,2)==1)ans=ans+1
            i=i/2
        end do
        ans=ans-1
    end if
    print*,ans
end program
0