結果

問題 No.222 引き算と足し算
ユーザー jjjj
提出日時 2016-09-07 23:27:07
言語 Fortran
(gFortran 14.2.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 553 bytes
コンパイル時間 644 ms
コンパイル使用メモリ 31,744 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-15 22:13:46
合計ジャッジ時間 1,532 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.f90:8:26:

    8 |   read (input(1:op-1)  ,*), x
      |                          1
Warning: Legacy Extension: Comma before i/o item list at (1)
Main.f90:9:26:

    9 |   read (input(op+1:len),*), y
      |                          1
Warning: Legacy Extension: Comma before i/o item list at (1)

ソースコード

diff #

program main
  implicit none
  character*13::input
  integer::x,y,op,len
  read *,input
  len = LEN_TRIM(input)
  op = find_op(input,len)
  read (input(1:op-1)  ,*), x
  read (input(op+1:len),*), y
  if(input(op:op).eq.'+') then
     print '(i0)',x-y
  else
     print '(i0)',x+y
  end if
contains
  function find_op(input,len) result(op)
    integer::op,len,i
    character*13::input
    do i=2,len
       if(input(i:i).eq.'+'.or.input(i:i).eq.'-') then
          op = i
          return
       end if
    end do
  end function find_op
end program main
0