## 10446 - The Marriage Interview :-)

Moderator: Board moderators

mak(cse_DU)
Learning poster
Posts: 72
Joined: Tue May 30, 2006 5:57 pm

### Re: 10446 - The Marriage Interview ;-)

I am little bit confused about description and sample input.
The input file contains several lines of input. Each line contains two integers n(n<=61) and back(back<=60).
But sample input
Sample Input

3 3

4 4

5 5

6 6

7 7

8 8

9 9

61 61 ----- back is greater than 60
The output for 60 60 is: 17293822569102704641

andmej
Experienced poster
Posts: 158
Joined: Sun Feb 04, 2007 7:45 pm
Location: Medellin, Colombia

### Re: 10446 - The Marriage Interview ;-)

Input is terminated by a case where the value of n is greater than 60. This line should not be processed.
Paradoxically, this is explained in the output specification. And yes, your output of 60 60 is correct.
Runtime errors in Pascal are reported as Wrong Answers by the online judge. Be careful.

Are you dreaming right now?
http://www.dreamviews.com

aliahmed
New poster
Posts: 24
Joined: Fri Oct 24, 2008 8:37 pm
Contact:

### Re: 10446 - The Marriage Interview ;-)

Why WA.. Can anyone help me..

Code: Select all

#include<stdio.h>

unsigned long long b[1000],i,j,k,l,back,cas=1;

int main()
{
long m,n;
while(scanf("%ld%ld",&m,&n))
{
if(m>60)
break;
if(m>1 && n==1)
{
printf("Case %llu: %ld\n",cas++,m);
continue;
}
else if(n<2 || m<2)
{
printf("Case %llu: 1\n",cas++);
continue;
}

for(i=0; i<=100; i++)	b[i]=0;

b[1]=1;	b[2]=n;
for(i=3; i<=m; i++)
{
for(j=0; j<i-2; j++)
{
b[i]+=b[j+2];
//printf("%I64u ",b[i]);
}
//printf("\n");
b[i]+=n;
}
//for(i=2; i<=m; i++)

printf("Case %llu: %llu\n",cas++,b[m]+1);

}

return 0;
}