結果

問題 No.185 和風
ユーザー con
提出日時 2018-11-20 18:21:24
言語 Fortran
(gFortran 14.2.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 453 bytes
コンパイル時間 158 ms
コンパイル使用メモリ 32,512 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-24 15:35:13
合計ジャッジ時間 721 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

implicit none
integer(8) i,N,M
integer(8),allocatable :: x(:)
integer(8),allocatable :: y(:)
integer(8),allocatable :: z(:)
read(*,*) N
allocate (x(N))
allocate (y(N))
allocate (z(N))
do i=1,N
   read(*,*) x(i),y(i)
end do
do i=1,N
   z(i)= y(i) -x(i)
end do
M=0
do i=1,N
   M=M+1
   if (z(i)/=z(i+1)) exit
end do
if (M==N) then
    if (z(M)>0) then
        write(*,*) z(M)
    else
        write(*,*) "-1"
    end if
else
    write(*,*) "-1"
end if
end
0