10446 - The Marriage Interview :-)

All about problems in Volume 104. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

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

Re: 10446 - The Marriage Interview ;-)

Post by mak(cse_DU) » Sat Jun 28, 2008 4:37 pm

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

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

Re: 10446 - The Marriage Interview ;-)

Post by andmej » Sun Jul 13, 2008 5:31 am

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
Location: CUET, Chittagong, Bangladesh
Contact:

Re: 10446 - The Marriage Interview ;-)

Post by aliahmed » Mon Mar 29, 2010 10:59 pm

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;
}

Post Reply

Return to “Volume 104 (10400-10499)”