結果
問題 |
No.356 円周上を回る3つの動点の一致
|
ユーザー |
![]() |
提出日時 | 2017-01-24 23:42:51 |
言語 | Fortran (gFortran 14.2.0) |
結果 |
AC
|
実行時間 | 1,855 ms / 5,000 ms |
コード長 | 677 bytes |
コンパイル時間 | 1,783 ms |
コンパイル使用メモリ | 31,360 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-13 21:11:36 |
合計ジャッジ時間 | 14,332 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 48 |
ソースコード
program main implicit none integer*8::a,b,c,ab,abc,aa,bb,cc,div integer*8::i read *,a,b,c ab = lcm(a,b) abc = lcm(ab,c) aa = abc/a bb = abc/b cc = abc/c do i=MIN(MIN(aa,bb),cc),1,-1 if(MOD(aa,i).eq.MOD(bb,i) .and.& MOD(aa,i).eq.MOD(cc,i)) then exit end if end do div = gcd(abc,i) print '(i0,"/",i0)',abc/div,i/div contains recursive function gcd(a,b) result(c) integer*8::a,b,c if(b.eq.0) then c = a else c = gcd(b,MOD(a,b)) end if end function gcd function lcm(a,b) result(c) integer*8,intent(in)::a,b integer*8::c c = (a*b)/gcd(a,b) end function lcm end program main