#include<cstdio> using namespace std; typedef long long int lld; lld t[100]={0}; lld total(int n) { if (n<0) return 0; if (t[n]==0) t[n]=total(n-2)+total(n-1)+1; return t[n]; } int main() { int n; t[0]=1; t[1]=2; while (scanf("%d",&n)==1) { if (n==-1) return 0; printf("%lld %lld\n",total(n-1),total(n)); } return 0; }
Monday, July 18, 2016
UVA 11000 Solution
Unknown
Studying at Shahjalal University of Science and Technology, Sylhet.
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment