Jump to content
em

[Medium] C++ crack

Recommended Posts

Posted (edited)

Se d? codul:


#include <iostream>
#include <cmath>
int main()
{
char input[7]={0};
std::cin>>input;
input[0]=input[0]*input[2]-input[1]*input[3]-input[4]-input[4]%input[6];
input[1]=(input[4]*input[5])%(--(--input[2]));
input[2]=(input[5]+input[6])-(input[2]%100);
input[3]=((input[0]+input[1])-4)>>(input[2]/100);
input[4]=((int) pow((++input[6]>>1),2)/3)-(input[6]+input[1]%76);
input[5]=(input[5]+input[6])-input[2]/10;
input[6]=((input[0]+input[1]*input[2])>>7)%((input[5]+2)>>1);

std::cout<<input;
}

Care este inputul astfel incat output sa fie winner!

Limite input : exact 7 caractere ascii.

Face?i cum vre?i. Nu va uitati la rezolvarile altora si postati si voi acelasi lucru. :)

Solvers:

- tromfil

- CyberWolf08

Edited by em
Posted


#include <iostream>
#include <cmath>
int main()
{
char input[7]={0};
std::cin>>input;
/*input[0]=input[0]*input[2]-input[1]*input[3]-input[4]-input[4]%input[6];
input[1]=(input[4]*input[5])%(--(--input[2]));
input[2]=(input[5]+input[6])-(input[2]%100);
input[3]=((input[0]+input[1])-4)>>(input[2]/100);
input[4]=((int) pow((++input[6]>>1),2)/3)-(input[6]+input[1]%76);
input[5]=(input[5]+input[6])-input[2]/10;
input[6]=((input[0]+input[1]*input[2])>>7)%((input[5]+2)>>1);*/

strcpy(input, "winner");

std::cout<<input;
}

Am facut cum am vrut :))

Posted

Eh. Prin cum vrei m-am referit ca o poti gandi fie matematic, fie faci un BK. (Pentru BK iti dau un indiciu ca parola mea este doar din litere mici + caracterele '-','_','O')

Oricum alegi sa o faci, ai ceva de invatat. (sper)

P.S.: Parola mea e parola mea, nu e unica desigur. :)

Posted

:)) Inteligent, la asta chiar nu ma gandisem!


#include <iostream>
#include <cmath>
int main()
{
char input[7]={0};
std::cin>>input;
/*input[0]=input[0]*input[2]-input[1]*input[3]-input[4]-input[4]%input[6];
input[1]=(input[4]*input[5])%(--(--input[2]));
input[2]=(input[5]+input[6])-(input[2]%100);
input[3]=((input[0]+input[1])-4)>>(input[2]/100);
input[4]=((int) pow((++input[6]>>1),2)/3)-(input[6]+input[1]%76);
input[5]=(input[5]+input[6])-input[2]/10;
input[6]=((input[0]+input[1]*input[2])>>7)%((input[5]+2)>>1);*/

strcpy(input, "winner");

std::cout<<input;
}

Am facut cum am vrut :))

Posted
Aplicam metoda de la Defcamp: http://i40.tinypic.com/2464aco.png :-"

Nu mai face afi??rile. Merge mult mult mai repede dac? nu le mai faci. :P (Sau le faci doar cand se schimba prima liter?).

Again. Parola doar din litere mici + caracterele {-,_,O}. Ar fi OK dac? ar incerca si persoane care nu au mai implementat un BK in viata lor (sa posteze aici bucati de cod si sa fie ajutati).

Posted
Deci o mica verificare: imput[2]='u', imput[4]='o' imput[5]='P' si imput[6]='.' ?

Pe solutia mea nu. Dar oricum nu e unica. :)

Da. BK - backtracking. In fine, se poate si cu 7 for-uri.

Posted

Ma doare capul ca am avut o zi plina de dimineata tare, deci las in aer asa. input2 si 6 se pot afla usor. 4 si 5 merg printr-un bkt cum ar veni mai lejer, iar restul tot rapid le aflati dupa aia. Posibil sa fie greseli, dar mersul e cam asa.

test - Pastebin.com

@em: p-ul ala e bun? macar atat. :))

  • Upvote 1
Posted
pe gcc se compileaza calumea si da output-ul dat in pastebin. Toate inputurile functioneaza.

Da. Scuze. Compilasem direct pe codepad si dadusem paste gresit.

Felicitari!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...