Advertisement
skb50bd

UVa 900 Brick Wall Patterns

Aug 28th, 2015
219
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     long long length, patterns, i, j, k;
  6.     while(true) {
  7.         cin >> length;
  8.         if(length == 0) break;
  9.         i = 0, j = 0, k = 1;
  10.         while(i < length) {
  11.             if(i != 0) k = patterns;
  12.             patterns = j + k;
  13.             j = k;
  14.             i++;
  15.         }
  16.         cout << patterns << endl;
  17.     }
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement