結果

問題 No.2441 行列累乗
ユーザー laneguelanegue
提出日時 2023-08-25 22:28:46
言語 D
(dmd 2.106.1)
結果
WA  
実行時間 -
コード長 498 bytes
コンパイル時間 2,937 ms
コンパイル使用メモリ 165,840 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-25 22:28:53
合計ジャッジ時間 3,986 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import std;
void main(){
  int[][] m;
  m ~= readln.chomp.split.to!(int[]);
  m ~= readln.chomp.split.to!(int[]);
  int[][] r = new int[][](2, 2);
  r[0][0] = 1;
  r[1][1] = 1;
  foreach(_;0 .. 3){
    r[0][0] = r[0][0] * m[0][0] + r[0][1] * m[1][0];
    r[0][1] = r[0][0] * m[0][1] + r[0][1] * m[1][1];
    r[1][0] = r[1][0] * m[0][0] + r[1][1] * m[1][0];
    r[1][1] = r[1][0] * m[0][1] + r[1][1] * m[1][1];
  }
  writeln(r[0].to!(string[]).join(" "));
  writeln(r[1].to!(string[]).join(" "));
}
0