#include #include #include #include #include #include #include #include using namespace std; #define ll long long #define pb push_back #define mkp make_pair #define fi first #define se second #define FOR(i, l, r) for(int i = l; i <= r; i++) #define ROF(i, r, l) for(int i = r; i >= l; i--) #define all(a) a.begin(), a.end() const int MAXN = 410; struct bign{ int len, s[MAXN]; bign (){ memset(s, 0, sizeof(s)); len = 1; } bign (int num) { *this = num; } bign (const char *num) { *this = num; } void clean(){ while(len > 1 && !s[len-1]) len--; } bign operator = (const int num){ char s[MAXN]; sprintf(s, "%d", num); *this = s; return *this; } bign operator = (const char *num){ for(int i = 0; num[i] == '0'; num++) ; //去前导0 len = strlen(num); for(int i = 0; i < len; i++) s[i] = num[len - i - 1] - '0'; return *this; } bign operator + (const bign &b) const{ bign c; c.len = max(len, b.len); for(int i = 0; i < c.len; i++){ c.s[i] += s[i] + b.s[i]; if (c.s[i] >= 10) c.s[i] -= 10, c.s[i + 1]++; } if (c.s[c.len]) c.len++; return c; } void operator += (const bign &b){ *this = *this + b; } bign operator * (const bign &b){ bign c; c.len = len + b.len; for(int i = 0; i < len; i++) for(int j = 0; j < b.len; j++) c.s[i + j] += s[i] * b.s[j]; for(int i = 0; i < c.len; i++){ c.s[i + 1] += c.s[i] / 10; c.s[i] %= 10; } c.clean(); return c; } void operator *= (const bign &b){ *this = *this * b; } bign operator - (const bign &b){ bign c; c.len = len; for(int i = 0; i < len; i++){ c.s[i] += s[i] - b.s[i]; if (c.s[i] < 0) c.s[i] += 10, c.s[i + 1]--; } c.clean(); return c; } void operator -= (const bign &b){ *this = *this - b; } bign operator / (const bign &b){ bign c, f = 0; for(int i = len-1; i >= 0; i--){ f = f * 10; f.s[0] = s[i]; while(f >= b){ f -= b; c.s[i]++; } } c.len = len; c.clean(); return c; } void operator /= (const bign &b){ *this = *this / b; } bign operator % (const bign &b){ bign r = *this / b; r = *this - r * b; return r; } void operator %= (const bign &b){ *this = *this % b; } bool operator < (const bign &b){ if(len != b.len) return len < b.len; for(int i = len - 1; i >= 0; i--){ if(s[i] != b.s[i]) return s[i] < b.s[i]; } return false; } bool operator > (const bign &b){ if(len != b.len) return len > b.len; for(int i = len - 1; i >= 0; i--){ if(s[i] != b.s[i]) return s[i] > b.s[i]; } return false; } bool operator == (const bign &b){ return !(*this > b) && !(*this < b); } bool operator != (const bign &b){ return !(*this == b); } bool operator <= (const bign &b){ return *this < b || *this == b; } bool operator >= (const bign &b){ return *this > b || *this == b; } string str() const{ string res = ""; for(int i = 0; i < len; i++) res = char(s[i]+'0') + res; return res; } }; istream& operator >> (istream &in, bign &x){ string s; in >> s; x = s.c_str(); return in; } ostream& operator << (ostream &out, const bign &x){ out << x.str(); return out; } int n; bign f[401]; int main(){ f[0] = f[1] = 1; for(int i = 2; i <= 400; i++) f[i] = f[i - 1] + f[i - 2]; while(~scanf("%d", &n)){ if(n == 0) cout << '\n'; else cout << f[n] << '\n'; } return 0; } /* _ooOoo_ o8888888o 88" . "88 (| -_- |) O\ = /O ____/`---'\____ .' \\| |// `. / \\||| : |||// \ / _||||| -:- |||||- \ | | \\\ - /// | | | \_| ''\---/'' | | \ .-\__ `-` ___/-. / ___`. .' /--.--\ `. . __ ."" '< `.___\_<|>_/___.' >'"". | | : `- \`.;`\ _ /`;.`/ - ` : | | \ \ `-. \_ __\ /__ _/ .-` / / ======`-.____`-.___\_____/___.-`____.-'====== `=---=' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 佛祖保佑 永无BUG */