Are there some combinatorics problems?

General topic about Valladolid Online Judge

Moderator: Board moderators

Post Reply
wlahhn
New poster
Posts: 1
Joined: Thu Jul 24, 2003 10:13 am

Are there some combinatorics problems?

Post by wlahhn »

Are there some combinatorics problems?
Thank you

bugzpodder
Experienced poster
Posts: 147
Joined: Fri Jun 13, 2003 10:46 pm

Post by bugzpodder »

146,151,305,369,530,10015,10105

Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba »

I solved the problem 140 the same way as 146, so I think it can be placed here as well.

Joseph Kurniawan
Experienced poster
Posts: 136
Joined: Tue Apr 01, 2003 6:59 am
Location: Jakarta, Indonesia

Post by Joseph Kurniawan »

146 - ID Codes?
To me it's more like sorting prob???

Krzysztof Duleba
Guru
Posts: 584
Joined: Thu Jun 19, 2003 3:48 am
Location: Sanok, Poland
Contact:

Post by Krzysztof Duleba »

Yes? What makes you to think so? Because it is not :-)

Joseph Kurniawan
Experienced poster
Posts: 136
Joined: Tue Apr 01, 2003 6:59 am
Location: Jakarta, Indonesia

Post by Joseph Kurniawan »

I'll try to find the source code.
But I'm pretty sure that I'm using sorting method instead of combination

turuthok
Experienced poster
Posts: 193
Joined: Thu Sep 19, 2002 6:39 am
Location: Indonesia
Contact:

Post by turuthok »

I second that ... I'm using a sorting method as well. But I guess there's probably more than one way to solve this problem. It all depends on your approach ...

-turuthok-
The fear of the LORD is the beginning of knowledge (Proverbs 1:7).

Joseph Kurniawan
Experienced poster
Posts: 136
Joined: Tue Apr 01, 2003 6:59 am
Location: Jakarta, Indonesia

Post by Joseph Kurniawan »

[c]
#include<stdio.h>
#include<string.h>
int i,j,k,l;
char a[60],temp;
void main(){
while(1){
scanf("%s",&a);
l=strlen(a);
if(a[0]=='#'){break;}
for(i=l-2;i>=0;i--){
k=i;
for(j=i+1,temp='{';j<l;j++){
if(a[j]>a&&a[j]<temp){k=j;temp=a[j];}
}
if(k!=i){a[k]=a;a=temp;break;}
}
if(i>-1){
for(j=i+1;j<l-1;j++){
k=j;
for(i=j+1;i<l;i++){
if(a<a[k]){k=i;}
}
if(k!=j){temp=a[k];a[k]=a[j];a[j]=temp;}
}
}
if(i>-1){printf("%s\n",a);}
else{printf("No Successor\n");}
}
}
[/c]
That's the code.

Post Reply

Return to “General”