| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:WA出翔来了!!!!!!太猥琐了,绝对有n大于250的数据,考虑n的范围在0~300包ACIn Reply To:WA出翔来了!!!!!!太猥琐了,绝对有n大于250的数据,考虑n的范围在0~300包AC Posted by:_Dongdong at 2012-05-19 11:17:08 肯定没有 这代码能过
#include <iostream>
#define base 100000000
int a[251][12];
int main(int argc, char** argv) {
a[0][0]=a[1][0]=1;
for(int i=2;i<=250;i++){
for(int j=0;a[i-1][j];j++){
a[i][j]+=a[i-1][j]+2*a[i-2][j];
if(a[i][j]>=base){
a[i][j+1]+=a[i][j]/base;
a[i][j]%=base;
}
}
}
int n;
while(~scanf("%d",&n)){
int j;
for(j=0;a[n][j];j++);
j--;
printf("%d",a[n][j--]);
while(j>=0)
printf("%08d",a[n][j--]);
printf("\n");
}
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator