TheTime Posted February 24, 2012 Report Share Posted February 24, 2012 Nice! Mai poti adauga in cod cate un comentariu din cand in cand, pentru cititori... Quote Link to comment Share on other sites More sharing options...
ionut.hulub Posted February 24, 2012 Report Share Posted February 24, 2012 poti sa adaugi un "using namespace std" ca sa iti usurezi munca... Quote Link to comment Share on other sites More sharing options...
Robert1995 Posted February 24, 2012 Report Share Posted February 24, 2012 poti sa adaugi un "using namespace std" ca sa iti usurezi munca...Am scris la inceput despre asta In legatura cu comentariile, probabil revin pe diseara Quote Link to comment Share on other sites More sharing options...
cmiN Posted February 24, 2012 Report Share Posted February 24, 2012 What about this or:>>> inlist = raw_input("Text: ").split()Text: mere portocale ana are mere>>> print " ".join(inlist[2:]).replace(inlist[0], inlist[1])ana are portocaleP.S.: In sursa de C++ replace face toata treaba, main e doar de fatada. Quote Link to comment Share on other sites More sharing options...
Robert1995 Posted February 24, 2012 Report Share Posted February 24, 2012 What about this or:>>> inlist = raw_input("Text: ").split()Text: mere portocale ana are mere>>> print " ".join(inlist[2:]).replace(inlist[0], inlist[1])ana are portocaleP.S.: In sursa de C++ replace face toata treaba, main e doar de fatada.Asa am facut si eu initial, pune testul meu si vezi ce se intampla P.S vorbesc de implementarea de pe paste-bin Quote Link to comment Share on other sites More sharing options...
cmiN Posted February 24, 2012 Report Share Posted February 24, 2012 Da, prima oara inainte sa incep scriptul m-am gandit la asta, dar doar din punct de vedere optimal nu si ca ar putea intra in bucla infinita, oricum am editat codul de pe pastebin, adaugand inca o singura linie in functia replace si face ce face si a ta.Inca o data scuze, cum m-am gandit ca ar scadea putin din viteza cautarea redundanta a valorilor deja inlocuite mi-am spus ca la nivelul asta nu conteaza acele nanosecunde in plus si am trecut mai departe, dar am uitat de acel caz, oricum am pus doar o linie in plus, acea incrementare la pos. Quote Link to comment Share on other sites More sharing options...