結果
| 問題 |
No.419 直角三角形
|
| コンテスト | |
| ユーザー |
notetonous
|
| 提出日時 | 2016-09-10 00:20:16 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 401 bytes |
| コンパイル時間 | 131 ms |
| コンパイル使用メモリ | 24,320 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-26 03:11:38 |
| 合計ジャッジ時間 | 910 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:15:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | scanf("%d %d",&a,&b);
| ^~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <math.h>
int min(int a,int b){
return a<b?a:b;
}
int max(int a,int b){
return a<b?b:a;
}
double min2(double a,double b){
return a<b?a:b;
}
int main(){
int a,b;
int l1,l2;
scanf("%d %d",&a,&b);
if(a==b){
printf("%lf\n",sqrt(a*a+b*b));
return 0;
}
l1=min(a,b);
l2=max(a,b);
printf("%.8lf\n",min2(sqrt(l1*l1+l2*l2),sqrt(l2*l2-l1*l1)));
return 0;
}
notetonous