Page 2 of 4

Posted: Tue Mar 22, 2005 11:54 pm
by refa
Anybody any idea, please?

Thank you

Posted: Wed Mar 23, 2005 3:01 am
by Sedefcho
Refa, why don't you change your algorithm.

Somebody , including me, can give you some hints.
But i am not sure if my algorithm is perfect. Still it gets accepted P.E.
in a reasonable time. It is in C++.

Or ?

Do you just need some test data ?

I think this problem is not that hard so it makes no sense
you use so brutal approach
like generating code and so on.

Posted: Wed Mar 23, 2005 12:45 pm
by refa
Dear Sedefcho,

thank you for your response. I will try to
solve it again on my own on a different
way and with a different aproach if I don't
succedd I will ask you again.. :)

Thank you pal :)

Posted: Wed Mar 23, 2005 6:30 pm
by Sedefcho
Sure, you're welcome.

Here is a small hint.

- Iterate through all possible values for K2 = fghij

- Iterate through all possible values N.

- Generate K1 = K2 * N.

Check if K1 has exactly five digits and that none of them is in the set {f, g, h, i, j }
This would mean you have a solution.

Just make sure you generate and print the solutions in the order the problem
wants you to print them.

And one more thing - I think leading zeros were allowed in K1 = abcde and K2 = fghij

The algorithm will work within the the time limit especially if written
in C/C++ and not in Java.

Posted: Sun Mar 27, 2005 11:55 am
by refa
Thank you Sedefcho, I got the idea.

Btw I got accepted with my old code I forgot one more value for 17 and that's why I got wrong answer all the time! I will try to solve the problem also on the way you showed me.

Thank you

Best regards,
Refik

Posted: Sun Sep 04, 2005 2:18 am
by Antonio Ocampo
Hi refa

I got 27 values for 17 like you :-? . Could you me give any hint?

Thx in advance :wink:

Posted: Mon Feb 20, 2006 12:22 pm
by scidong
Oh my gosh.
plz speack English-!

Posted: Mon Feb 20, 2006 12:25 pm
by scidong
Hmm.
Who are you GUEST?
Plz 'leave now & don`t come back!'

725 RTE ?

Posted: Sat Jul 22, 2006 9:12 pm
by Masud_CSE_SUST
Sorry, Not TLE

Posted: Sun Jul 23, 2006 9:03 pm
by IRA
It doesn't use long long to solve the problem.....
I see your method.It doesn't got TLE.
You must to check what step make infinite loop....

725 - How to optimize?

Posted: Fri Sep 01, 2006 10:05 am
by Donotalo
i'm using the following algorithm:

abcde / fghij = N

Code: Select all

1. starting from 50123, iterate through all possible valid permutation of abcde.
2. obtain the minimum value of fghij. if abcde / fghij < N then obtain next abcde and continue this step.
3. iterate through all possible permutations of fghij. for every abcde == fghij * N, that is a solution. break this iteration as soon as a solution is found and obtain next abcde. go to step 2.
i dont know how to optimize it further. :( this algo is taking 2-3 minutes in my 866 MHz PC to generate solutions from 2 to 79. can anyone help me to optimize it?

725 Wrong Answer

Posted: Sun Oct 29, 2006 3:45 pm
by Anupam Pathak
Hi all,
I tried to solve 725 "Division" problem but i m getting wrong answer.
I am posting my code. Please give me some more test cases, so that i can find my error.

thanx very much..

Posted: Mon Oct 30, 2006 4:13 pm
by Jan
Try the I/O set

Input:

Code: Select all

44
53
0
Output:

Code: Select all

58476 / 01329 = 44
59268 / 01347 = 44
67892 / 01543 = 44
69432 / 01578 = 44
95348 / 02167 = 44

65879 / 01243 = 53
75896 / 01432 = 53
84376 / 01592 = 53
92538 / 01746 = 53
Hope it helps.

Posted: Tue Oct 31, 2006 6:06 am
by Anupam Pathak
thanx sir,
though I have solve the problem,,
thanx very much :D

725 why PE ?

Posted: Thu Dec 14, 2006 12:19 am
by Spykaj

Code: Select all

int main(){

  int i,n,k,b;

  while(scanf("%d",&n)&&n){
    b=0;
    for(i=((1000/n)*n+n)*n; i<100000; i+=n){
      k=i/n;
      if(rozne(i,k)){
        printf("%05d / %05d = %d\n",i,i/n,n);
        b=1;
      }
    }
    if(b==0)printf("There are no solutions for %d.\n",n);
    printf("\n");
  }
  return 0;
}
Help plz :( PE :(