結果

問題 No.642 Two Operations No.1
ユーザー 37zigen
提出日時 2018-04-18 21:47:45
言語 Fortran
(gFortran 14.2.0)
結果
WA  
実行時間 -
コード長 353 bytes
コンパイル時間 1,373 ms
コンパイル使用メモリ 31,104 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-06-27 04:34:26
合計ジャッジ時間 2,359 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 6 WA * 9
権限があれば一括ダウンロードができます

ソースコード

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