結果
問題 |
No.53 悪の漸化式
|
ユーザー |
![]() |
提出日時 | 2014-10-30 23:47:35 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 529 bytes |
コンパイル時間 | 670 ms |
コンパイル使用メモリ | 63,808 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-30 14:45:41 |
合計ジャッジ時間 | 1,501 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 17 WA * 3 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:11:20: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | int n;scanf("%d",&n); | ~~~~~^~~~~~~~~
ソースコード
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <math.h> #include <iostream> #include <vector> using namespace std; int main(){ int n;scanf("%d",&n); double a=4,a1=3,a2; if(n==0){ printf("4\n");return 0; } else if(n==1){ printf("3\n");return 0; } for(int i=2;i<=n;i++){ a2=(19/4.0*a1-3.0*a); a=a1; a1=a2; if(a2<(double)1e-9){ a2=0; break; } } if(a2==0)printf("0\n"); else printf("%0.10f\n",a2); //else printf("%0.10f\n",a2); return 0; }