結果

問題 No.9010 うるう年判定
ユーザー data9824
提出日時 2019-11-30 14:39:03
言語 Assembler
(nasm 2.16.03)
結果
RE  
実行時間 -
コード長 955 bytes
コンパイル時間 532 ms
コンパイル使用メモリ 6,820 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-11-21 01:16:40
合計ジャッジ時間 4,703 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample RE * 4
other RE * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
ld: 警告: エントリシンボル _start が見つかりません。デフォルトとして 0000000000401000 を使用します

ソースコード

diff #

  global  _start

  section .text

  xor eax, eax
loop:
  push rax
  mov eax, 3 ; sys_read
  mov ebx, 0 ; fd
  mov ecx, input
  mov edx, 1
  int 0x80
  xor ecx, ecx
  mov cl, [input]
  cmp cl, 0x0a
  pop rax
  je readend
  mov edx, 10
  mul edx
  sub ecx, 0x30 ; '0'
  add eax, ecx
  jmp loop

readend:
  mov esi, eax

  xor edx, edx
  mov eax, esi
  mov ecx, 400
  div ecx
  test edx, edx
  je yes

  mov eax, esi
  xor edx, edx
  mov eax, esi
  mov ecx, 100
  div ecx
  test edx, edx
  je no
  
  mov eax, esi
  xor edx, edx
  mov eax, esi
  mov ecx, 4
  div ecx
  test edx, edx
  je yes

no:
  mov eax, 4 ; sys_write
  mov ebx, 1 ; fd
  mov ecx, notext
  mov edx, 3
  int 0x80

  mov eax, 60
  mov edi, 0
  int 0x80
  ret

yes:
  mov eax, 4 ; sys_write
  mov ebx, 1 ; fd
  mov ecx, yestext
  mov edx, 4
  int 0x80

  mov eax, 60
  mov edi, 0
  int 0x80
  ret

  section .data
  
input db 0
notext db "no"
       db 0x0a
yestext db "yes"
       db 0x0a
0