結果
問題 |
No.159 刺さらないUSB
|
ユーザー |
![]() |
提出日時 | 2018-04-15 19:14:27 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 284 bytes |
コンパイル時間 | 127 ms |
コンパイル使用メモリ | 23,168 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-02 00:07:45 |
合計ジャッジ時間 | 859 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 18 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:6:15: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 6 | scanf ("%lf %lf",&p,&q); | ~~~~~~^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main() { double p,q,s[3]={0,}; scanf ("%lf %lf",&p,&q); for (int k=0;k<2;k++){ int v = k; double r = k ? p : 1-p; for (int i=0;i<3;i++){ if (v){ s[i] += r * q; r *= (1 - q); } v = !v; } } puts(s[1]<s[2]?"YES":"NO"); return 0; }