結果

問題 No.358 も~っと!門松列
ユーザー jjjj
提出日時 2016-07-28 14:10:40
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 739 bytes
コンパイル時間 497 ms
コンパイル使用メモリ 27,416 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-06 15:04:09
合計ジャッジ時間 1,483 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

integer function kadomatsu(b) result(n)
  integer::b(1:3)
  if ( (b(1).ne.b(3)).and. &
       ((b(2).gt.b(1).and.b(2).gt.b(3)) .or. &
       (b(2).lt.b(1).and.b(2).lt.b(3))) ) then
     n = 1
  else
     n = 0
  end if
end function kadomatsu

program main
  implicit none
  interface
     integer function kadomatsu(b) result(n)
       integer::b(1:3)
     end function kadomatsu
  end interface
  integer::a(3),b(3),p,total=0
  read *,a

  if ( kadomatsu(a) .eq. 1 ) then
     print '(a)', "INF"
     return
  else if ((a(1).eq.a(2)).or.(a(2).eq.a(3)).or.(a(3).eq.a(1))) then
     print '(i0)',0
     return
  end if

  do p=1, MAXVAL(a)
     b = MOD(a,p)
     total = total + kadomatsu(b)
  end do
  print '(i0)', total
end program main
0