#include <iostream>
using namespace std;
long long int fib[52]={1};
int main() {
int q, i;
fib[0]=1;
fib[1]=1;
for (i=2 ; i<53 ; i++) {
fib[i]=fib[i-1]+fib[i-2];
}
while (scanf("%d",&q)==1 && q) {
printf("%lld\n",fib[q]);
}
return 0;
}
Thursday, September 02, 2010
[UVa] 900 - Brick Wall Patterns
A simple sequence related problem. The sequence that it maintains is Fibonacci, with the fib[0] as 1. Other things are just as they always were. Here's the code:
Subscribe to:
Post Comments (Atom)
Connect Rapoo MT750S with Linux (Tested on Manjaro)
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
I like coding a lot, keeps me glued to the PC for hours. For that reason it's a need to edit the Syntax Highlighter to suit my eyes for...
-
I bought this obvious copy of MX Master 2S in hopes of having the device switching functionality along with a lightweight body because I ha...
-
Install MinGW GCC Port on Windows. 1. Just go to this address [ http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ ]...
No comments:
Post a Comment
Post your comment here. If you want to say something about programming problems, scripts, software etc, please try to be as descriptive as possible.