結果
問題 |
No.450 ベー君のシャトルラン
|
ユーザー |
![]() |
提出日時 | 2016-12-01 03:08:43 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 672 bytes |
コンパイル時間 | 146 ms |
コンパイル使用メモリ | 23,040 KB |
実行使用メモリ | 10,624 KB |
最終ジャッジ日時 | 2024-11-27 15:07:57 |
合計ジャッジ時間 | 6,937 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 TLE * 2 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:5:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%lf %lf %lf %lf",&v1,&v2,&d,&w); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int main(){ double v1,v2,d,w; scanf("%lf %lf %lf %lf",&v1,&v2,&d,&w); double total=0; double touch=0; int direction=0; while(d>0.0000001){ // if(direction==0){//右向き touch=w*d/(w+v2);//蜂が右の車にぶつかるまでの距離 // printf("%lf\n",touch); total+=touch; d-=(v1+v2)*d/(w+v2);//左右の車が動いた距離を減らす // printf("total=%lf nokori=%lf\n",total,d); // direction=1; // }else{//左向き touch=w*d/(w+v1); // printf("%lf\n",touch); total+=touch; d-=(v1+v2)*d/(w+v1); // printf("total=%lf nokori=%lf\n",total,d); // direction=0; // } } printf("%f\n",total); return 0; }