結果
問題 | No.419 直角三角形 |
ユーザー |
![]() |
提出日時 | 2016-10-21 09:01:17 |
言語 | Perl (5.40.0) |
結果 |
AC
|
実行時間 | 9 ms / 1,000 ms |
コード長 | 416 bytes |
コンパイル時間 | 46 ms |
コンパイル使用メモリ | 6,948 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-23 15:59:29 |
合計ジャッジ時間 | 1,027 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
コンパイルメッセージ
Main.pl syntax OK
ソースコード
use strict;use warnings;use utf8;use List::Util qw(max);use List::Util qw(min);my $input = <STDIN>;chomp($input);my @arr = split(/ /, $input);my $a = $arr[0];my $b = $arr[1];my $bigger = max ($a, $b);my $smaller = min ($a, $b);my $ans = 0;if ($bigger == $smaller){$ans = sqrt($bigger**2 + $smaller**2);print "$ans\n";}else{$ans = sqrt($bigger**2 - $smaller**2);print "$ans\n";}