結果
問題 | No.2426 Select Plus or Minus |
ユーザー |
|
提出日時 | 2023-08-18 21:48:13 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 846 bytes |
コンパイル時間 | 403 ms |
コンパイル使用メモリ | 32,640 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-28 06:31:24 |
合計ジャッジ時間 | 1,848 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 41 |
ソースコード
program yukicoder_2426use, intrinsic :: iso_fortran_envimplicit noneinteger(int32), parameter :: max_len = 10000integer(int64) :: n, mcharacter(len=:), allocatable :: operationsinteger(int32) :: kread(input_unit, *) nallocate(character(len=max_len) :: operations)operations(1:max_len) = ""m = ndo k = 1, max_lenif (m == 1) exitif (iand(m, b'1') == 0) thenm = m / 2operations(k:k) = "/"else !> b is odd.if (iand((3 * m + 1) / 2, b'1') == 0) thenm = 3 * m + 1operations(k:k) = "+"else !> iand((3 * m - 1) / 2, b'1') == 0m = 3 * m - 1operations(k:k) = "-"end ifend ifend dowrite(output_unit, '(i0)') len_trim(operations)write(output_unit, '(a)') trim(operations)end program yukicoder_2426