| | | Show all threads     Hide all threads     Show all messages     Hide all messages |  | How can be z==2? | Valeriya Krinitsyna | 1428. Jedi Riddle | 13 Nov 2019 22:05 | 1 |  | In the example 2 2 3, z==5. Why do everybody say that z==2? |  | What is wrong here?С# | Константин | 1428. Jedi Riddle | 3 Mar 2019 17:44 | 1 |  | using System;
 class Entrypiont
 {
 static void Main()
 {
 string[] Input = Console.ReadLine().Split(' ');
 int a = Convert.ToInt32(Input[0]);
 int b = Convert.ToInt32(Input[1]);
 int c = Convert.ToInt32(Input[2]);
 if(((c-1)%a)==((c-1)%b) && ((c - 1) % a) == 0)
 {
 int x=1, y=1, z=1;
 while (true)
 {
 if(Math.Pow(x,a)+ Math.Pow(y, b)== Math.Pow(z, c))
 {
 Console.Write(x);
 Console.Write(y);
 Console.Write(z);
 break;
 }
 else
 {
 if(Math.Pow(x, a) + Math.Pow(y, b) >Math.Pow(z, c))
 {
 z++;
 }
 else
 {
 if (x >= y)
 {
 y++;
 }
 else
 {
 x++;
 }
 
 }
 }
 }
 }
 
 Console.ReadLine();
 }
 }
 |  | WA#52 | Babies | 1428. Jedi Riddle | 16 Oct 2016 19:44 | 2 |  | WA#52 Babies 20 Apr 2013 22:56 Hi, i have problem with WA#52, I used long long and test 1 1 32 => accept.This's my code :
 #include <iostream>
 using namespace System;
 using namespace std;
 long long func( long long x , int po );
 
 void main() {
 
 long long a,b,c,y,k,x,n,m;
 cin>>a>>b>>c;
 
 k = (c-1)/a;
 m = (c-1)/b;
 x = func( k ,2 );
 y = func( m , 2 );
 
 printf("%lld\n%lld\n2",x,y);
 system("pause");
 }
 
 long long func( long long x , int po ) {
 long long temp=2;
 for( int i=1; i<x; i++ ) {
 temp *= po;
 }
 return temp;
 }
Hi, I had WA 52 too, these tests helped me:1) 1 1 1
 2) 5 10 1
 
 Edited by author 16.10.2016 19:50
 |  | WA#1 | Rushboy | 1428. Jedi Riddle | 5 Jan 2013 16:02 | 1 |  | WA#1 Rushboy 5 Jan 2013 16:02 why?
 here is the code:
 
 #include <iostream>
 #include <cmath>
 using namespace std;
 
 int main(){
 long long X,Y,Z,k,l,m;
 short A,B,C;
 cin>>A>>B>>C;
 k=(C-1)/A;
 l=(C-1)/B;
 X=1;Y=1;
 for(long i=1;i<=k;i++)
 X*=2;
 for(long i=1;i<=l;i++)
 Y*=2;
 cout<<X<<" "<<Y<<" "<<"2";
 return 0;
 }
 |  | WA#51 | And IV | 1428. Jedi Riddle | 12 Jun 2012 05:03 | 2 |  | WA#51 And IV 13 Nov 2007 01:01 If you have WA51 you can use "long long" instead "int" in order to solve the problem. |  | example | Mihail Nikalyukin(It-Team) | 1428. Jedi Riddle | 3 Sep 2009 19:20 | 3 |  | example Mihail Nikalyukin(It-Team) 2 Sep 2009 11:15 what about example?input 2 2 3
 output 10 5 5
 but 2*10+5*2!=5*3 ->20+10!=15 -> 30!=15
 where im wrong?
you need not 10*2+5*2=5*3, but 10^2+5^2=5^3 (100+25=125)Re: example Mihail Nikalyukin(It-Team) 3 Sep 2009 19:20 omg, thanks a lot :)now im got AC
 
 
 
 Edited by author 03.09.2009 20:53
 |  | What's the formula? | Yashar Abbasov | 1428. Jedi Riddle | 14 Nov 2007 22:48 | 4 |  | Hi I think there is a special formula for this problem.Can anybody ,who knows, post it, please?
n=(c-1)/a; m=(c-1)b;Answer 2^n 2^m 2
n=(c-1)/a; m=(c-1)b;Answer 2^n 2^m 2
 EASY PrOblem
And IV, thank you very much. |  | I asumed that Z = 2 and then solved problem. but I can't proove it. can you? | @ntiFreeze | 1428. Jedi Riddle | 27 Feb 2007 02:41 | 3 |  |  
 Edited by author 27.02.2007 00:36
Simple)) z = 2; So x^a+y^b=2^c => 2^(c-1) + 2^(c-1) == 2^(c-1)*(1+1) == 2^(c-1)* 2^1 = 2^(c-1+1) == 2^c; => x^a == 2^(c-1), y^b = 2^(c-1) => x == 2^((c-1)/a), y== 2^((c-1)/b). |  | Problem 1428 "Jedi riddle" has been rejudged (+) | Vladimir Yakovlev (USU) | 1428. Jedi Riddle | 14 Jan 2007 19:01 | 10 |  | New tests were added. 77 authors lost AC.Don't know what kind of tests were added, but all I had to do is to change type of X,Y from int to __int64 in order to get AC againOnly worse case is1 1 32 -> And answer must be 2^32 > max_int
My solution (and, as far as I know, author's one also) produces answers <= 2^31.When my soulution produced <= 2^31 I had Wa52. But when I changed it to <= 2^32 -> ACI think we speak about different things...You speak about type, in which result is stored.
 And I say that there is correct formula, which produces results <= 2^31.
Yes. If you are used to C style.^ is usual designation for power.
yes I know(long long)2<<31 = int64(2 shl 31) = 2^32
 it's max answer of my formula for
 test 1 1 32 which was added just 1 week ago
 |  | Please help... | Roma Labish[Lviv NU] | 1428. Jedi Riddle | 10 Jan 2007 01:01 | 8 |  | [deleted] I got Accept.
 Edited by author 09.01.2007 23:57
a=1, b=1, c=31 =>z = 2^30+1
 x = (2*(2^30+1))^30 > 2^900 > 10^50
 But in statements is said that answers should not exceed 10^50.
Thanks. I understood my mistake. But am I in a right way, or I must think about somethink else ?Alright ;)Just invent another one formula.
 Mine produces numbers <= 2^31.
On right way... If you want, I could give you the true formula!!!Thanks, but I got Accept:).Of course, if you want, you can help me with 1106, because after rejudging I had WA#11 :(Post your mail, I'll try to help you.Mail: w_soulreaver@ukr.net    Thanks. |  | Just Let C=2. It will be easy. | TheBeet | 1428. Jedi Riddle | 30 Jul 2006 17:29 | 1 |  |  | 
 | 
 |