bzoj 1962: 模型王子
呵呵呵呵http://wenku.baidu.com/link?url=o0CPVzuBDLJMt0_7Qph1T7TtdFOzu7O-apIpvaWbIYMz8ZWqBneGqI8LGtLdqpuK5fbQ_v-H01zHwPXDsPrioR5xjCDHjqJn_boYO87ikr_
1 #include <bits/stdc++.h> 2 #define LL long long 3 #define lowbit(x) x&(-x) 4 #define inf 0x3f3f3f3f 5 using namespace std; 6 inline int ra() 7 { 8 int x=0,f=1; char ch=getchar(); 9 while (ch<'0' || ch>'9') {if (ch=='-') f=-1; ch=getchar();} 10 while (ch>='0' && ch<='9') {x=x*10+ch-'0'; ch=getchar();} 11 return x*f; 12 } 13 int n,K; 14 int f[100005][105]; 15 int main(int argc, char const *argv[]) 16 { 17 n=ra(); K=ra(); 18 for (int i=2; ; i++) 19 { 20 f[i][1]=i/2; 21 for (int j=2; j<=K; j++) 22 f[i][j]=max(f[i-1][j]+f[i-2][j-2],f[i-2][j]+f[i-1][j-1])+1; 23 if (f[i][K]>=n) {cout<<i; break;} 24 } 25 return 0; 26 }