| ||||||||||
| 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:其实这道题不一定要开数组的In Reply To:其实这道题不一定要开数组的 Posted by:majia8 at 2009-04-08 20:16:33 只需要类似滚筒数组的思路,只需要5个变量
这样就可以了
void main(){
int a,b,m;
char c,t;
while(scanf("%c",&c),c!='0'){
b=1;
a=1;
while(scanf("%c",&t),t!='\n'){
if(t=='0')m=a;
else if(c=='1'||c=='2'&&t<'7')m=a+b;
else m=b;
a=b;
b=m;
c=t;
}
printf("%d\n",m);
}
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator