11313 - Gourmet Games

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

Moderator: Board moderators

Post Reply
User avatar
nahid
New poster
Posts: 18
Joined: Wed Oct 04, 2006 8:59 pm
Location: DHAKA,BANGLADESH
Contact:

11313 - Gourmet Games

Post by nahid » Thu Aug 21, 2008 8:33 pm

As usual i'm having WA with this easy problem. here is my code. would u pls check it .
Thanks In advance.

Code: Select all

#include <stdio.h>

int main()
{
	int n,m,ns,lc,temp,t,count;

	scanf("%d",&t);

	while(t--)
	{
		scanf("%d%d",&n,&m);
		ns = n/m;
		lc = n%m;
		temp = ns + lc;

		count = 1;

		while (temp>=m)
		{
			ns = temp/m;
			lc = temp%m;
			temp = ns + lc;
			count++;
		}

		if (lc != 0)
			printf("cannot do this");
		else
			printf("%d",count);
		if(t)
			printf("\n");

	}
	
	return 0;
}

Samiul
New poster
Posts: 36
Joined: Thu Dec 13, 2007 3:01 pm

Re: 11313 - GOURMET GAMES

Post by Samiul » Sun Aug 24, 2008 8:37 am

Each time you are updating the variable temp, you are increasing count by 1 but it would be increased by the number of shows held, which is ns.

lnr
Experienced poster
Posts: 142
Joined: Sat Jun 30, 2007 2:52 pm
Location: Dhaka,Bangladesh

Re: 11313 - GOURMET GAMES

Post by lnr » Tue Oct 07, 2008 4:08 pm

To nahid
Check this.

Input:

Code: Select all

1
8 2
Output:

Code: Select all

7

Shafaet_du
Experienced poster
Posts: 147
Joined: Mon Jun 07, 2010 11:43 am
Location: University Of Dhaka,Bangladesh
Contact:

Re: 11313 - GOURMET GAMES

Post by Shafaet_du » Mon Nov 08, 2010 11:52 pm

Nice adhoc :).
sample:

Code: Select all

7
10 4
11 4
19 2
100 10
999 32
345 234
10000 12
output:

Code: Select all

3
cannot do this
18
11
cannot do this
cannot do this
909

User avatar
mahade hasan
Learning poster
Posts: 87
Joined: Thu Dec 15, 2011 3:08 pm
Location: University of Rajshahi,Bangladesh

Re: 11313 - GOURMET GAMES

Post by mahade hasan » Mon Oct 28, 2013 4:02 pm

cuttttttttttttt
we r surrounded by happiness
need eyes to feel it!

User avatar
uDebug
A great helper
Posts: 475
Joined: Tue Jul 24, 2012 4:23 pm

Re: 11313 - GOURMET GAMES

Post by uDebug » Thu Jul 10, 2014 1:39 pm

Shafaet_du,
Thanks for the test cases.
Check input and AC output for over 7,500 problems on uDebug!

Find us on Facebook. Follow us on Twitter.

Post Reply

Return to “Volume 113 (11300-11399)”