結果

問題 No.419 直角三角形
ユーザー Toriyabot
提出日時 2016-10-21 08:58:20
言語 Perl
(5.40.0)
結果
WA  
実行時間 -
コード長 393 bytes
コンパイル時間 626 ms
コンパイル使用メモリ 6,948 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-23 15:59:27
合計ジャッジ時間 1,205 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 WA * 3
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

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 = $bigger;
    print "$ans\n";
}else{
    $ans = sqrt($bigger**2 - $smaller**2);
    print "$ans\n";
}

0