結果

問題 No.185 和風
ユーザー concon
提出日時 2018-11-20 18:21:24
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 453 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 27,216 KB
実行使用メモリ 4,376 KB
最終ジャッジ日時 2023-08-26 02:19:52
合計ジャッジ時間 868 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

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