結果

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

ソースコード

diff #

#include<cstdio>
int main(void) {
	long long int N, a[3], i;
	scanf("%lld", &N);
	a[0] = 1;
	a[1] = 1;
for (i = 0; N > i+1; i++) {
	a[2] = a[1] + a[0];
	a[0] = a[1];
	a[1] = a[2];
}
printf("%lld", a[2]);
	return  0;
}
0