JZOJ 3461. 小麦亩产一千八(kela)
题目
分析
- 显然,斐波那契直接上
- a b 20?? 暴力
代码
1 #include <cmath> 2 #include <cstdio> 3 #include <cstring> 4 #include <iostream> 5 #include <algorithm> 6 #define ll long long 7 const int N = 35; 8 using namespace std; 9 int c[23][2]={{0,0},{0,1},{1,1},{1,2},{2,3},{3,5},{5,8},{8,13},{13,21},{21,34},{34,55},{55,89},{89,144},{144,233},{233,377},{377,610},{610,987},{987,1597},{1597,2584},{2584,4181},{4181,6765},{6765,10946},{10946,17711}}; 10 int main() 11 { 12 ll a,x,b; 13 while (scanf("%lld%lld%lld",&a,&x,&b)!=EOF) 14 { 15 if ((x-c[a][0])%c[a][1]==0) 16 printf("%lld\n",((x-c[a][0])/c[a][1])*c[b][1]+c[b][0]); 17 else cout<<-1<<endl; 18 } 19 return 0; 20 }
为何要逼自己长大,去闯不该闯的荒唐