結果

問題 No.44 DPなすごろく
ユーザー megashares
提出日時 2018-09-14 22:14:00
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 264 bytes
コンパイル時間 244 ms
コンパイル使用メモリ 22,656 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-06 11:07:43
合計ジャッジ時間 841 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%d", &n);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
typedef unsigned long long ll;

int main() {
	int n;
	ll f[60];

	scanf("%d", &n);

	f[0] = 0; f[1] = 1; f[2] = 2;

	int i;
	for (i = 3; i <= n; i++) {
		f[i] = f[i - 1] + f[i - 2];
	}

	printf("%llu", f[n]);

	getchar(); getchar();
	return 0;
}
0