結果

問題 No.44 DPなすごろく
ユーザー ok
提出日時 2018-09-23 16:51:38
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 270 bytes
コンパイル時間 521 ms
コンパイル使用メモリ 53,592 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-14 06:08:55
合計ジャッジ時間 4,306 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 RE * 3
other AC * 5 RE * 15
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:17: warning: format ‘%d’ expects argument of type ‘int*’, but argument 2 has type ‘long long int*’ [-Wformat=]
   11 |         scanf("%d", &N);
      |                ~^   ~~
      |                 |   |
      |                 |   long long int*
      |                 int*
      |                %lld
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d", &N);
      |         ~~~~~^~~~~~~~~~

ソースコード

diff #

#include<iostream>
#include<stdio.h>
using namespace std;
#define MAX_VAL 54
#define int long long


signed main(){
	int N,dp[MAX_VAL] = {1,1};
	
	scanf("%d", &N);
	
	for(int i = 0; i <= N; i++){
		dp[i+2] = dp[i+1] + dp[i];
	}
	
	printf("%lld\n", dp[N]);
	
	return 0;
}
0