Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:其实这道题不一定要开数组的

Posted by deathspeaker at 2009-04-08 22:03:22 on Problem 2033
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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator