結果

問題 No.612 Move on grid
ユーザー 37zigen37zigen
提出日時 2018-04-10 23:27:04
言語 Fortran
(gFortran 13.2.0)
結果
WA  
実行時間 -
コード長 792 bytes
コンパイル時間 340 ms
コンパイル使用メモリ 27,640 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-09-09 03:58:44
合計ジャッジ時間 1,379 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

program main
    implicit none
    integer(8)::g(0:1,-10000:10000),p=1000000007,t,a,b,c,d,e,ans=0,i,j,k,r,f(3)
    read*,t
    read(*,*)a,b,c,d,e
    f(1)=a
    f(2)=b
    f(3)=c
    do i=0,1
        do j=-10000,10000
            g(i,j)=0
        end do
    end do
    g(0,0)=1
    do i=1,t
        do j=-10000,10000
            g(mod(i,2),j)=0
        end do
        do j=-10000,10000
            if(g(mod(i+1,2),j)==0)cycle
            do k=1,3
                do r=-1,1,2
                    g(mod(i,2),j+f(k))=g(mod(i,2),j+r*f(k))+g(mod(i+1,2),j)
                    if(g(mod(i,2),j+f(k))>=p)g(mod(i,2),j+f(k))=g(mod(i,2),j+f(k))-p
                end do
            end do
        end do
    end do
    do i=d,e
        ans=mod(ans+g(mod(t,2),i),p)
    end do
    print*,ans
end program
0