結果

問題 No.2870 Dice Making
ユーザー osada-yum
提出日時 2024-11-17 04:02:52
言語 Fortran
(gFortran 14.2.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 661 bytes
コンパイル時間 1,550 ms
コンパイル使用メモリ 31,488 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-17 04:02:56
合計ジャッジ時間 2,430 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

!> This file was processed by `fypp`.
!> Today's fortune: "Lucky:)", really OK?
!> ランダムウォーク猿「'Dijkstra' で はっぴー.」
program f902870
  use, intrinsic :: iso_fortran_env
  !> auto use module
  implicit none
  integer(int32) :: n, k
  integer(int32), allocatable :: ans(:)
  read(input_unit, *) n, k
  if (n == 1 .and. n /= k) then
     write(output_unit, '(i0)') -1
     stop
  end if
  if (k > n .or. mod(n, k) /= 0) then
     write(output_unit, '(i0)') -1
     stop
  end if
  allocate(ans(n), source = 2)
  associate(num1 => n / k)
    ans(1:num1) = 1
  end associate
  write(output_unit, '(*(i0, 1x))') ans(:)
end program f902870
0