답안 #128686

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
128686 2019-07-11T08:26:17 Z 김세빈(#3158) Fibonacci representations (CEOI18_fib) C++14
0 / 100
7 ms 2040 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

const ll mod = 1e9 + 7;

ll F[22];
ll dp[101010];
ll n, ans;

int main()
{
	ll i, j, a, s;
	
	scanf("%lld", &n);
	
	F[0] = 1, F[1] = 1;
	for(i=2; i<=15; i++){
		F[i] = F[i - 1] + F[i - 2];
	}
	
	dp[0] = 1;
	
	for(i=1; i<=15; i++){
		for(j=100000; j>=F[i]; j--){
			dp[j] = (dp[j] + dp[j - F[i]]) % mod;
		}
	}
	
	for(i=1, s=0; i<=n; i++){
		scanf("%lld", &a); s += F[a];
		printf("%lld\n", dp[s]);
	}
	
	return 0;
}

Compilation message

fib.cpp: In function 'int main()':
fib.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &n);
  ~~~~~^~~~~~~~~~~~
fib.cpp:33:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld", &a); s += F[a];
   ~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1144 KB Output is correct
2 Incorrect 6 ms 1144 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1144 KB Output is correct
2 Incorrect 6 ms 1144 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1144 KB Output is correct
2 Incorrect 6 ms 1144 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 7 ms 2040 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 1144 KB Output is correct
2 Incorrect 6 ms 1144 KB Output isn't correct
3 Halted 0 ms 0 KB -