結果

問題 No.401 数字の渦巻き
ユーザー jjjj
提出日時 2016-07-22 23:14:36
言語 Fortran
(gFortran 13.2.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 805 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 33,368 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 02:36:55
合計ジャッジ時間 919 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

  integer::N
  integer,allocatable::num(:,:)
  integer::dim,itr,offset
  character*32::cformat='(i0.3,  i4.3)'
  read*,N
  allocate(num(N,N))

  if (N.eq.1) then
     print '(a)',"001"
     return
  end if
  ! even
  offset = 0
  do itr=1,N/2
     dim = N-itr*2+1
     do i=itr, itr+dim-1
        num(i,itr) = offset+i
     end do
     offset = offset + dim
     do i=itr, itr+dim-1
        num(N-itr+1,i) = offset + i
     end do
     offset = offset + dim
     do i=itr, itr+dim-1
        num(N-i+1,N-itr+1) = offset + i
     end do
     offset = offset + dim
     do i=itr, itr+dim-1
        num(itr,N-i+1) = offset + i
     end do
     offset=offset + dim - 1
  end do

  if ( mod(N,2) .eq. 1) then
     num(N/2+1,N/2+1)=N*N
  end if

  write (cformat(7:8),'(i2)') N-1
  print cformat,num
end program
0