結果

問題 No.1050 Zero (Maximum)
ユーザー trineutrontrineutron
提出日時 2020-05-09 09:46:46
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 563 bytes
コンパイル時間 639 ms
コンパイル使用メモリ 28,316 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-18 15:17:06
合計ジャッジ時間 1,695 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

program main
    implicit none
    integer(16) :: i, j, m, k, mat0(0:49, 0:49), mat(0:49, 0:49)
    read *, m, k
    do i = 0, m - 1
        mat0(i, i) = 1
        do j = 0, m - 1
            mat(mod(i+j, m), i) = mat(mod(i+j, m), i) + 1
            mat(mod(i*j, m), i) = mat(mod(i*j, m), i) + 1
        end do
    end do
    do while (k > 0)
        if (mod(k, 2) == 1) then
            mat0 = mod(matmul(mat0, mat), 1000000007)
        end if
        mat = mod(matmul(mat, mat), 1000000007)
        k = k / 2
    end do
    print *, mat0(0, 0)
end program main
0