DP URAL 1260 Nudnik Photographer
5263 단어 Graph
제목 전송문
1 /* 2 DP: dp[i] i , n-2 3 */ 4 #include <cstdio> 5 #include <algorithm> 6 #include <cmath> 7 #include <cstring> 8 using namespace std; 9 10 const int MAXN = 1e4 + 10; 11 const int INF = 0x3f3f3f3f; 12 int dp[60]; 13 14 int main(void) //URAL 1260 Nudnik Photographer 15 { 16 //freopen ("G.in", "r", stdin); 17 18 int n; 19 while (scanf ("%d", &n) == 1) 20 { 21 memset (dp, 0, sizeof (dp)); 22 dp[1] = 1; 23 for (int i=2; i<=n; ++i) 24 { 25 dp[i] = dp[i-1]; 26 if (i > 3) 27 { 28 dp[i] += dp[i-3]; 29 } 30 } 31 32 long long ans = dp[n]; 33 if (n > 2) 34 { 35 for (int i=1; i<=n-2; ++i) ans += dp[i]; 36 } 37 printf ("%I64d
", ans); 38 } 39 40 return 0; 41 }
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
plotlyplotly js란, 데이터를 dashboard를 통해 시각화 시켜주는 도구이다. (plotly js는 자바스크립트 안에서 사용된다.) plotly js를 사용하게 된 이유는? 회사에서 프로젝트에서 dashboard...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.