costi buci de cal Posted October 27, 2018 Share Posted October 27, 2018 ba nu ma prind https://i.postimg.cc/pTkd4vvc/Screenshot-1.png asta defapt Link to comment Share on other sites More sharing options...
Dyablox Posted October 27, 2018 Author Share Posted October 27, 2018 Stai sa deschid si eu codeblocks. Link to comment Share on other sites More sharing options...
costi buci de cal Posted October 27, 2018 Share Posted October 27, 2018 (edited) aa da si trebuia sa pun for mic ia-l de aici #include <iostream> using namespace std; boolean prim { int x = 0; for (i = 2; i < n-1; i++) if (n%i != 0) x++; if (n-2 == x) { return true; } else { return false; } } while(a != 0) { x = x * 10 + a % 10; a = a / 10; //asta este inversul lui a } int main() { boolean(); int n, x, a, i; cin >> a ; cin >> x; while(a != 0) { x = x * 10 + a % 10; a = a / 10; //asta este inversul lui a } } nu merge editat lol Edited October 27, 2018 by Bilosul Link to comment Share on other sites More sharing options...
Dyablox Posted October 27, 2018 Author Share Posted October 27, 2018 Codul meu e mai optim: #include <iostream> using namespace std; bool prim(int x) { if(x == 2) return true; for(int i = 2; i <= x / 2; i++) if(x % i == 0) return false; return true; } int invers(int n) { int m = 0; while (n != 0) { m = m * 10 + n % 10; n = n / 10; } return m; } int main() { cin << b; if(prim(b) && prim(invers(b))) cout << "DA"; else cout << "NU"; return 0; } Link to comment Share on other sites More sharing options...
costi buci de cal Posted October 27, 2018 Share Posted October 27, 2018 e mai optim dar imi zice ca in main " b " n-a fost declarat iar atunci cand il pun imi face spam de erori l-ai testat? Link to comment Share on other sites More sharing options...
Dyablox Posted October 27, 2018 Author Share Posted October 27, 2018 Da, doar ca ii atribuiam direct valoare lui b, fara sa-l citesc, si cand l-am scris aici am schimbat si am uitat sa-l declar. Link to comment Share on other sites More sharing options...
costi buci de cal Posted October 27, 2018 Share Posted October 27, 2018 int b; si cin >> b ; l-am testat si functioneaza bine dar dc primesc 90 de puncte? ;D brb toaleta de aur Link to comment Share on other sites More sharing options...
Dyablox Posted October 27, 2018 Author Share Posted October 27, 2018 La codul meu ai primit 90%? Link to comment Share on other sites More sharing options...
Lil Wald Posted October 27, 2018 Share Posted October 27, 2018 12 minutes ago, rTn Dyablox VIP said: Codul meu e mai optim: #include <iostream> using namespace std; bool prim(int x) { if(x == 2) return true; for(int i = 2; i <= x / 2; i++) if(x % i == 0) return false; return true; } int invers(int n) { int m = 0; while (n != 0) { m = m * 10 + n % 10; n = n / 10; } return m; } int main() { cin << b; if(prim(b) && prim(invers(b))) cout << "DA"; else cout << "NU"; return 0; } Link to comment Share on other sites More sharing options...
costi buci de cal Posted October 27, 2018 Share Posted October 27, 2018 da, la al tau am primit atat se potriveste poza, green =)))0 Link to comment Share on other sites More sharing options...
Lil Wald Posted October 27, 2018 Share Posted October 27, 2018 4 minutes ago, Bilosul said: se potriveste poza, green =)))0 stiu Link to comment Share on other sites More sharing options...
costi buci de cal Posted October 27, 2018 Share Posted October 27, 2018 tu ce ai mai facut astazi? eu 2 ore am incercat sa rezolv Link to comment Share on other sites More sharing options...
Dyablox Posted October 27, 2018 Author Share Posted October 27, 2018 Pai arata-mi valoarea unde a dat 0 puncte. Link to comment Share on other sites More sharing options...
Lil Wald Posted October 27, 2018 Share Posted October 27, 2018 22 minutes ago, Bilosul said: tu ce ai mai facut astazi? eu 2 ore am incercat sa rezolv bn // LITT Link to comment Share on other sites More sharing options...
Lian Posted October 27, 2018 Share Posted October 27, 2018 ba da hekeri sunteti voi astia daici ,eu ma uit si nu inteleg nmk =]] Link to comment Share on other sites More sharing options...
costi buci de cal Posted October 27, 2018 Share Posted October 27, 2018 2 hours ago, rTn Dyablox VIP said: unde a n-arata unde ai gresit, asta e naspa la platforma asta ;D Link to comment Share on other sites More sharing options...
Dyablox Posted October 27, 2018 Author Share Posted October 27, 2018 Pai acolo unde iti arata 10 puncte, nu inseamna ca a fost corect? Link to comment Share on other sites More sharing options...
costi buci de cal Posted October 27, 2018 Share Posted October 27, 2018 da, 10 puncte e maxim si 0 inseamna ca ai gresit undeva ba ce naspa e sa stai in casa toata ziua, no? Link to comment Share on other sites More sharing options...
Dyablox Posted October 27, 2018 Author Share Posted October 27, 2018 De ce? Eu cum stau in casa doar cand dorm... Link to comment Share on other sites More sharing options...
costi buci de cal Posted October 27, 2018 Share Posted October 27, 2018 pai si in rest stai pe pc doar la scoala ? Link to comment Share on other sites More sharing options...
Dyablox Posted October 27, 2018 Author Share Posted October 27, 2018 La scoala invat, la munca lucrez si asa trece fiecare zi. Link to comment Share on other sites More sharing options...
costi buci de cal Posted October 27, 2018 Share Posted October 27, 2018 ce lucrezi ? ba frt am 70 grade spre 76 pe youtube daca ma uit in MXH5, mi se pare aiurea rau de tooooooot Link to comment Share on other sites More sharing options...
Dyablox Posted October 27, 2018 Author Share Posted October 27, 2018 Programator, mai concret PHP developer. Link to comment Share on other sites More sharing options...
costi buci de cal Posted October 27, 2018 Share Posted October 27, 2018 deja te-au angajat lol ? ce faci intr-o zi obisnuita? 4 ore munca si restul sedinte? o zi de munca* Link to comment Share on other sites More sharing options...
Dyablox Posted October 27, 2018 Author Share Posted October 27, 2018 Tinand cont ca lucrez part time - 4 ore, nu reusesc la sedinte Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now