Solved by 232 users: ...
UserDateAttemptTimeCMSC
greck`12 may 2008`Ruby100.0387
bush`10 jan 2013`Ruby1400.0290
bush`10 jan 2013`Ruby1300.0297
gchebanov`02 dec 2010`Python700.06103
shurik`07 may 2009`Ruby2200.07105
bush`10 jan 2013`Ruby600.02110
Evgenii`24 jan 2011`C++1400.01115
bush`10 jan 2013`Ruby500.02119
bush`10 jan 2013`Ruby1200.02120
MasterYoda`16 jul 2009`C++600.02121
MasterYoda`16 jul 2009`C++500.01122
shurik`10 oct 2008`Ruby2000.06122
shurik`10 oct 2008`Ruby2100.06122
gchebanov`02 dec 2010`Python400.06123
MasterYoda`16 jul 2009`C++400.01126
ethanhunt`24 may 2011`C600.01133
ethanhunt`24 may 2011`C500.01135
mikelan`03 mar 2012`C200.01137
shurik`10 oct 2008`Ruby1900.05138
dzhavaharnal`07 jul 2016`Ruby1100.02142
N1k1tung`11 mar 2009`C++800.37144
Evgenii`24 jan 2011`C++1200.01148
ethanhunt`24 may 2011`C300.01153
ethanhunt`24 may 2011`C400.01153
Evgenii`24 jan 2011`C++1000.01154
 C++ 149 Java 28 Kylix 17 FPC 15 C 14 Ruby 8 Python 5 Haskell 2 Scheme 1
` >  >  >  >  >  >  >  >  >  > `

## Fibonacci II

Time limit = 1 second(s)

Find F(N) % K (binary operator % stands for residual).

Definition: F(1) = F(2) = 1.   F(n) = F(n-1) + F(n-2).

Input. Two lines with two numbers — N and K. 1 ≤ N, K ≤ 2 000 000 000.

Output One line with F(N) % K .

 Input#1```9 3 ``` Output#1```1 ```
 Input#2```66 66 ``` Output#2```52 ```

Author:
Nikolay Strakhov
16 May 2008

 © acm.mipt DevGroupThe page was generated in 180ms