結果

問題 No.53 悪の漸化式
ユーザー moyashi_senpaimoyashi_senpai
提出日時 2016-08-26 22:08:01
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 710 bytes
コンパイル時間 549 ms
コンパイル使用メモリ 79,104 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-25 21:30:30
合計ジャッジ時間 1,377 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:25:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   25 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#define REP(i,n) for(int i = 0; n > i; i++)
#define MOD 1000000007
#define accm(i) ( (i)%2 ? od[((i)-1)/2] : ev[(i)/2])
#define acc(i) ( i%2 ? cpod[(i-1)/2] : cpev[i/2])
using namespace std;
typedef vector<int> Ivec;
typedef pair<int, int> pii;

int main() {
	int n;
	scanf("%d", &n);

	double dp[101] = {};
	dp[0] = 4;
	dp[1] = 3;
	
	for(int i = 2; 100 >= i; i++){
		dp[i] = (dp[i - 1] * 19 - dp[i - 2] * 12) / 4;
	}
	printf("%lf\n", dp[n]);
	return 0;
}
0