Moderator: Board moderators

lnr
Experienced poster
Posts: 141
Joined: Sat Jun 30, 2007 2:52 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

### Re: 11723 - Numbering Roads

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

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

### Re: 11723 - Numbering Roads

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

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

### Re: 11723 - Numbering Roads

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

### Re: 11723 - Numbering Roads

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

### Re: 11723 - Numbering Roads

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....

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)

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

zobayer
Experienced poster
Posts: 110
Joined: Tue May 06, 2008 2:18 pm
Contact:

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

shaon_cse_cu08 wrote:
For the problem Uva toolkit is not responding... .
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.

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)

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 .....

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

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...

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

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