結果
問題 | No.300 平方数 |
ユーザー |
![]() |
提出日時 | 2016-09-19 03:19:05 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
AC
|
実行時間 | 14 ms / 1,000 ms |
コード長 | 1,050 bytes |
コンパイル時間 | 1,321 ms |
コンパイル使用メモリ | 33,980 KB |
実行使用メモリ | 10,132 KB |
最終ジャッジ日時 | 2024-11-17 09:10:41 |
合計ジャッジ時間 | 2,910 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 43 |
ソースコード
program mainimplicit noneinteger*8::X,Y,upper,iinteger*8,allocatable::base(:),exponents(:)read *,Xupper = DINT(log(DBLE(X)))+1_8allocate(base(upper),exponents(upper))base = 0exponents = 0call factorization(X, base, exponents)Y = 1do i=1,size(base)if(MOD(exponents(i),2).ne.0) Y = Y * base(i)end doprint '(i0)', Ycontainssubroutine factorization(n, base, exponents)integer*8::n,base(:),exponents(:)integer*8::i,j,itr,upperinteger*8,allocatable::furui(:)data itr/0/upper = INT(SQRT(DBLE(n)+1))allocate(furui(2:upper))furui = 0do i=2,upperif(furui(i).ne.0) cycleif(MOD(n, i).ne.0) cycleitr = itr + 1base(itr) = ido j=i+i,upper,ifurui(j) = 1end dodo j=1,uppern = n/iif(MOD(n,i).ne.0) exitend doexponents(itr) = jif(n.eq.1) returnend doitr = itr + 1base(itr) = nexponents(itr) = 1end subroutine factorizationend program main