結果
問題 | No.2534 コラッツ数列 |
ユーザー |
|
提出日時 | 2023-11-10 22:19:28 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,037 bytes |
コンパイル時間 | 521 ms |
コンパイル使用メモリ | 31,488 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-26 01:45:17 |
合計ジャッジ時間 | 1,474 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 33 |
ソースコード
program yukicoder_2534use, intrinsic :: iso_fortran_envimplicit noneinteger(int32), parameter :: max_iter = 50integer(int32) :: ninteger(int32) :: iread(input_unit, *) ncall operation_1(n)containssubroutine operation_1(n)integer(int32), intent(in) :: ncall operation_2(n, 2)end subroutine operation_1recursive subroutine operation_2(n, i)integer(int32), intent(in) :: n, iif (i > max_iter) thenwrite(output_unit, '(a)') "No"stopelse if (n == 1) thenwrite(output_unit, '(a)') "Yes"write(output_unit, '(i0)') istopend ifcall operation_3(n, i + 1)end subroutine operation_2recursive subroutine operation_3(n, i)integer(int32), intent(in) :: n, iif (i > max_iter) thenwrite(output_unit, '(a)') "No"stopend ifif (iand(n, b'1') == 0) thencall operation_2(n / 2, i + 1)elsecall operation_2(3 * n + 1, i + 1)end ifend subroutine operation_3end program yukicoder_2534