11723 - Numbering Roads

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

Moderator: Board moderators

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

11723 - Numbering Roads

Post by lnr » Tue Jun 15, 2010 7:07 pm

Can someone give some hint for this problem?
Can't understand how the result is 1 for input 8 5

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

Re: 11723 - Numbering Roads

Post by lnr » Wed Jun 16, 2010 7:14 am

Code:

Code: Select all

    testCase=1;                                                                                                              
    while(scanf("%d %d",&a,&b)==2){
        if(a+b==0){
            break;
        }   
        printf("Case %d: ",testCase);
        save=a-b;
        t=save/b;
        g=save%b;
        if(t>26){
            printf("impossible\n");
            testCase++;
            continue;
        }   
        if(g==0){
            printf("%d\n",t);
            testCase++;
            continue;
        }   
        printf("%d\n",t+1);
        testCase++;
    }   

yan yan
New poster
Posts: 13
Joined: Thu May 13, 2010 4:16 pm
Location: Viet Nam
Contact:

Re: 11723 - Numbering Roads

Post by yan yan » Wed Jun 16, 2010 11:27 am

lnr wrote:Can someone give some hint for this problem?
Can't understand how the result is 1 for input 8 5
you can named 8 streets: 1 2 3 4 5 1A 2A 3A !
So, you only need one suffix!
:)

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

Re: 11723 - Numbering Roads

Post by lnr » Wed Jun 16, 2010 1:52 pm

yan yan wrote:
lnr wrote:Can someone give some hint for this problem?
Can't understand how the result is 1 for input 8 5
you can named 8 streets: 1 2 3 4 5 1A 2A 3A !
So, you only need one suffix!
:)
I did the same thing.But still wrong answer.
Code:

Code: Select all

#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<map>
#include<set>
#include<cctype>
#include<stack>
#include<queue>
#include<iterator>
#include<sstream>
using namespace std;

#define PI 2.0*acos(0.0)
typedef long long ll;

int testCase,i,j,k,l,m,n,x,y,z,a,b,c,d,e,f,g,t,save;

void process(){
	testCase=1;
	while(scanf("%d %d",&a,&b)==2){
		if(a+b==0){
			break;
		}
		printf("Case %d: ",testCase);
		save=a-b;
		t=save/b;
		g=save%b;
		if(t>26){
			printf("impossible\n");
			testCase++;
			continue;
		}
		if(g==0){
			printf("%d\n",t);
			testCase++;
			continue;
		}
		printf("%d\n",t+1);
		testCase++;
	}
}

int main() {
//	freopen("in.txt","r",stdin);
	process();
	return 0;
}

yan yan
New poster
Posts: 13
Joined: Thu May 13, 2010 4:16 pm
Location: Viet Nam
Contact:

Re: 11723 - Numbering Roads

Post by yan yan » Thu Jun 17, 2010 3:35 am

try this:

Code: Select all

5 8
i think output should be

Code: Select all

Case 1: 0

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

Re: 11723 - Numbering Roads

Post by lnr » Thu Jun 17, 2010 6:51 pm

yan yan wrote:try this:

Code: Select all

5 8
i think output should be

Code: Select all

Case 1: 0
I also did this still wrong answer.
Can someone post some input output?

naseef_07cuet
Learning poster
Posts: 62
Joined: Sat Nov 21, 2009 10:17 pm
Location: CUET,Chittagong,Bangladesh

Re: 11723 - Numbering Roads

Post by naseef_07cuet » Sun Jun 27, 2010 11:26 pm

Check this:

Code: Select all

53 2
11 6
7 7
output will be

Code: Select all

Case 1: 26
Case 2: 1
Case 3: 0
If you have determination, you can do anything you want....:)

naseef_07cuet
Learning poster
Posts: 62
Joined: Sat Nov 21, 2009 10:17 pm
Location: CUET,Chittagong,Bangladesh

Re: 11723 - Numbering Roads

Post by naseef_07cuet » Sun Jun 27, 2010 11:30 pm

I don't understood these lines from your code:

Code: Select all

if(g==0){
         printf("%d\n",t);
         testCase++;
         continue;
      }
      printf("%d\n",t+1);
why 2 printf function......:(
If you have determination, you can do anything you want....:)

User avatar
shaon_cse_cu08
New poster
Posts: 50
Joined: Tue May 25, 2010 9:10 am
Contact:

11723 Numbering the rods (Uva toolkit is not responding)

Post by shaon_cse_cu08 » Tue Aug 10, 2010 12:26 pm

For the problem Uva toolkit is not responding... :oops: .
I'll keep holding on...Until the walls come tumbling down...And freedom is all around ..... :x

zobayer
Experienced poster
Posts: 110
Joined: Tue May 06, 2008 2:18 pm
Location: CSE-DU, Bangladesh
Contact:

Re: 11723 Numbering the rods (Uva toolkit is not responding)

Post by zobayer » Tue Aug 10, 2010 7:19 pm

shaon_cse_cu08 wrote:
For the problem Uva toolkit is not responding... :oops: .
Why do you need something like that to solve a problem? And, what you might not know is, for many problems, uva toolkit gives wrong outputs.

And you don't need to add "quote" tags around all your posts, these tags are used to quote other's statements, not your own....

Happy coding.
You should not always say what you know, but you should always know what you say.

User avatar
shaon_cse_cu08
New poster
Posts: 50
Joined: Tue May 25, 2010 9:10 am
Contact:

Re: 11723 Numbering the rods (Uva toolkit is not responding)

Post by shaon_cse_cu08 » Tue Aug 10, 2010 7:28 pm

But for many problems UVa toolkit is must....Coz in those problems da sample input/output is not so much clear.... And isn't it all about Bugs and suggestion?? Its not like i m killing any 1 by suggesting about this problem..... And sry for the Quote part and I will try 2 use da toolkit as less as possible.....
I'll keep holding on...Until the walls come tumbling down...And freedom is all around ..... :x

durjay
New poster
Posts: 13
Joined: Tue Oct 06, 2009 5:09 pm
Location: ctg

11723-Numbering Roads!

Post by durjay » Thu Sep 09, 2010 6:16 pm

I thought this problem easily. I just do the addition with no of integer from 1 to 26.if this addition greater then no of roads then i use break condition.
But i got WA.
Is that my process is correct ?????

here is my code:

//Removed after accepted...

Advance thanx for help!!!!!!!!!!!
Last edited by durjay on Thu Sep 16, 2010 6:20 pm, edited 1 time in total.

naseef_07cuet
Learning poster
Posts: 62
Joined: Sat Nov 21, 2009 10:17 pm
Location: CUET,Chittagong,Bangladesh

Re: 11723-Numbering Roads!

Post by naseef_07cuet » Thu Sep 16, 2010 12:11 pm

Dear Durjay,
Check this case:
1 1
Output should be: Case 1: 0
but your program gives :Case 1: 1

fix it.read and understand problem statement more carefully.

Happy Coding :)

Naseef
CUET DURBER
If you have determination, you can do anything you want....:)

durjay
New poster
Posts: 13
Joined: Tue Oct 06, 2009 5:09 pm
Location: ctg

Re: 11723-Numbering Roads!

Post by durjay » Thu Sep 16, 2010 6:19 pm

Thanks naseef.....
Now i got accepted..... :D

EryCihuii
New poster
Posts: 1
Joined: Wed Oct 13, 2010 11:22 am

Re: 11723-Numbering Roads!

Post by EryCihuii » Wed Oct 13, 2010 11:26 am

I have tried 4 times. But still get WA.
Is there any special case?

Post Reply

Return to “Volume 117 (11700-11799)”