Jump to content

em

Active Members
  • Posts

    1909
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by em

  1. Merge de minune. Nici un antivirus nu miroase nimic.
  2. O parte din programatori nu scriu cod eficient fie ca habar nu au ca scriu prost (asta e si vina IDE-ului care compileaza direct cu -O3) fie ca stiu ca oricum compilatorul le repara prostiile. De curand am avut de facut un proiect si nu aveam voie sa folosesc flagurile -O1, -O2, -O3 la compilare. Linkurile de mai jos mi-au folosit. Optimizing C and C++ Code Adjust structure sizes to power of two Place case labels in narrow range Place frequent case labels first Break big switch statements into nested switches Minimize local variables Declare local variables in the inner most scope Reduce the number of parameters Use references for parameter passing and return value for types bigger than 4 bytes Don't define a return value if not used Consider locality of reference for code and data Prefer int over char and short Define lightweight constructors Prefer initialization over assignment Use constructor initialization lists Do not declare "just in case" virtual functions In-line 1 to 3 line functions C++ Optimization Strategies and Techniques General Strategies There's a right way and a wrong way to do optimization. Here's some strategies common to all programming endeavors that work and don't work. Optimization Strategies that Bomb Optimization Strategies that Work Example of Selecting the Proper Algorithm C++ Design Considerations When you start working on your next app and begin to think about coding conventions, compilers, libraries, and general C++ issues, there are many factors to consider. In this section I weigh performance issues involved with C++ design considerations. Take advantage of STL containers Consider using references instead of pointers Consider two-phase construction Limit exception handling Avoid Runtime Type Identification Prefer stdio to iostream Evaluate alternative libraries C++ Optimizations You Can Do "As You Go" Defy the software engineering mantra of "optimization procrastination." These techniques can be added to your code today! In general, these methods not only make your code more efficient, but increase readability and maintainability, too. Pass class parameters by reference Postpone variable declaration as long as possible Prefer initialization over assignment Use constructor initialization lists Prefer operator= over operator alone Use prefix operators Use explicit constructors Final Optimizations Your app is up and running. The data structures are ideal, the algorithms sublime, the code elegant, but the program - well, it's not quite living up to its potential. Time to get drastic, and with drastic measures, there are tradeoffs to consider. These optimizations are going to make your code less modular, harder to understand, and more difficult to maintain. They may cause unexpected side effects like code bloat. Your compiler may not even be able to handle some of the more advanced template-based techniques. Proceed with caution. Arm yourself with a good profiler. Inline functions Avoid temporary objects: the return value optimization Be aware of the cost of virtual functions Return objects via reference parameters Consider per-class allocation Consider STL container allocators The "empty member" optimization Template metaprogramming Copy on write Compiler Optimizations A good compiler can have a huge effect on code performance. Most PC compilers are good, but not great, at optimization. Be aware that sometimes the compiler won't perform optimizations even though it can. The compiler assigns a higher priority to producing consistent and correct code than optimizing performance. Be thankful for small favors. C language settings C++ language settings The "ultimate" compiler settings Use the novtable option for abstract classes (Microsoft Visual C++) Indicate functions that don't throw exceptions Use the fastcall calling convention (Microsoft Visual C++) Warning: Unsafe optimizations Appendices STL Container efficiency table Relative costs of common programming operations C code tuning and C++ efficiency resources The Author
      • 1
      • Upvote
  3. Este o diferenta intre criptare si rezumare. Datele nu puteau fi criptate cu md5 sau sha256.
  4. Mie pe g++ 4.6.1 merge. Dar intr-adevar este un abuz de notatie. Am punctat solutia doar pentru ca mi-a mers. Felicitari participantilor.
  5. em

    Borland C++ 3.1

    @euovidiu In postul lui Nytro. Programming tools.... Uite un link aici.
  6. Dupa ce au incurajat in mod constant utilizatorii sa isi lase cardul la indemna lor, ca e sigur (Steam wallet) acum vin sa ne spuna ca baza de date a fost compromisa (bine, erau criptate datele bancare, cica). Nonetheless you should watch your credit card activity and statements closely
  7. Am vrut sa zic char x='1'. Cum am dat copy/paste din PM-ul cuiva si prima oara nu s-au copiat ghilimelele. Si pe urma am uitat. Mersi. @H3xoR, Cea cu int x=1.1 merge. Ce compilator folosesti? L.E. : Nu avem doamne pe forum.
  8. Dear Steam Users and Steam Forum Users: Our Steam forums were defaced on the evening of Sunday, November 6. We began investigating and found that the intrusion goes beyond the Steam forums. We learned that intruders obtained access to a Steam database in addition to the forums. This database contained information including user names, hashed and salted passwords, game purchases, email addresses, billing addresses and encrypted credit card information. We do not have evidence that encrypted credit card numbers or personally identifying information were taken by the intruders, or that the protection on credit card numbers or passwords was cracked. We are still investigating. We don't have evidence of credit card misuse at this time. Nonetheless you should watch your credit card activity and statements closely. While we only know of a few forum accounts that have been compromised, all forum users will be required to change their passwords the next time they login. If you have used your Steam forum password on other accounts you should change those passwords as well. We do not know of any compromised Steam accounts, so we are not planning to force a change of Steam account passwords (which are separate from forum passwords). However, it wouldn’t be a bad idea to change that as well, especially if it is the same as your Steam forum account password. We will reopen the forums as soon as we can. I am truly sorry this happened, and I apologize for the inconvenience. Gabe. Sursa: aici
  9. Closed. O solutie char x='1'; Extra: Sweby,aphex int x; x=1.1; totti93 #define if (a) if (!(a)) Nytro #define x 1<0
  10. Pentru ca am vazut ca penultimul meu challenge a fost un esec (doar o persoana a raspuns) am decis sa postez lucruri mult mai scurte. Gigel a decis sa ajute la un proiect open source si a deschis una din sutele de surse. Intr-un fisier a vazut codul. ... if(x==1) cout<<"x este 1, continuam executia "; else cout<<"am primit eroarea "<<x; ... Gigel a compilat sursa si a vazut mesajul "am primit eroarea 1"; Cum se poate asa ceva? Raspunsuri prin PM. Comentarii aici. Solvers - AlStar - cifratorul - plm - Nytro - Robert1995 - Serar - bogdannbv - Sweby - cea mai originala solutie - anon - Ellimist - adonisslanic - BGS - H3xoR - aphdex - totti93 - hit47 - DuTy^ Closed!
  11. Da. Scuze. Compilasem direct pe codepad si dadusem paste gresit. Felicitari!
  12. Cred ca si tu ai un typo. Mie toate imputurile tale imi genereaza yioods".
  13. Funfact: Zatarra, ai trecut de la Linux Administrator -> Moderator. (Stiu ca chiar crezuse cineva o data ca esti admin). Felicitari.
  14. Ca si rezolvata. P.S.: p-ul Nu e bun. input2-2 trebuie sa fie 114 <=> input2=112 ?! Ultimul caracter e bun. Felicitari!
  15. Pe solutia mea nu. Dar oricum nu e unica. Da. BK - backtracking. In fine, se poate si cu 7 for-uri.
  16. Nu mai face afi??rile. Merge mult mult mai repede dac? nu le mai faci. (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).
  17. P?i nu e bine oricum. Afi?eaz? winner nu winner!
  18. 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.
  19. 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
  20. Nu multumesc.
  21. Trebuie s? ave?i Windows 8 s? v? mearg? linkul. La mine a mers.
  22. em

    thread help

    Ce limbaj? C++ cu openmp sau java cu Thread? LE: Vezi algoritmii Odd-Even transposition sort sau Row-Column sort. Daca nu te descurci cu implementarea da un reply. LE: Eu nu cred ca poti paraleliza merge sort in felul asta eficient. Dupa ce fiecare thread isi va termina bucata lui vei ramane cu un vector mare sortat pe bucati. Si apoi sa faci ce? Iar merge sort? PS: Hai sa nu mai dam edit la posturi ca sa permitem altora sa urmareasca mai usor threadul.
  23. em

    Programming Tools

    Pentru programatorii de java. Va recomand Intellij Idea. De ce acest IDE si nu altele? - continua rularea unui program chiar daca a aruncat o exceptie. (Sa zic ca fac o impartire la 0 undeva, imi arata eroarea si merge mai departe). - are o predictie excelenta. Face o analiza a codului si practic poate depista unele erori din analiza fluxului de date. (O data inversasem parametrii coordonatelor ox cu oy la un proiect in openGL, si m-a atentionat). - tine procesorul si memoria jos. Extra info aici.
  24. Codul tau nu este complet. Specifica sursa.
  25. Se poate sa iti pui ce date vrei la cont. Numele nu va mai putea fi schimbat ulterior, adresa da. Poti adauga card cu orice date vrei dar LAST NAME trebuie sa coincida. Daca cei de la pp miros fake te pot pune sa confirmi unele date (cu buletin/factura de utilitati scanata). Uite un exemplu Eu pe contul acesta nu pot adauga carduri decat pe numele de familie "Macelaru". Referitor la a doua intrebare. Cum ascunzi whois-ul la un site. Iti cumperi private registration (la godaddy te va costa extra cam $5 pe an).
×
×
  • Create New...