Detalii evaluare #48387055

Rezumat problemă

#1412 Desen

Se dau 2 numere naturale c și n, de o singură cifra. În funcție de valoarea lui c construiți o figură geometrică formată din cifre de la 1 la n, ca în exemple.

Detalii

Problema Desen Operații I/O tastatură/ecran
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #48387055 Utilizator as sa (Bill_Hates)
Fișier desen.cpp Dimensiune 1.90 KB
Data încărcării 23 Ianuarie 2024, 21:44 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

desen.cpp: In function 'int main()':
desen.cpp:2:180: error: 'cin' was not declared in this scope
 unsigned long long int sum(unsigned long long int a) { return a * (a + 1) / 2; } int main() { int c, n, vv, nr = 1, rand = 0, sex = 0, nrcacat = 0, nri = 1, reset = 0, copyn = 0; cin >> c >> n; vv = n; copyn = 2 * n - 1; if (c == 1) { while (vv > 0) { cout << nr; vv--; if (vv == 0 && nr < n) { vv = n; nr++; cout << endl; } } } int sex2 = 1, rand2 = 1, nrcacat2 = 2 * n - 1, reset2 = 0, part2 = 0, nr2 = n - 1; if (c == 2) { rand = n * 2 - 1; sex = n - 1; while (sex > 0) { if (nr2 == 0) break; if (part2 == 1) { if (nr2 == 0) break; while (reset >= n - 1 && reset <= (2 * n - 1)) { if (nr2 == 0) break; while (sex2 > 0) { if (nr2 == 0) break; cout << " "; nrcacat2--; rand2++; sex2--; if (sex2 == 0) { if (nr2 == 0) break; while (nrcacat2 >= rand2) { cout << nr2; nrcacat2--; } sex2 = nrcacat2; if (nrcacat2 == 0) { if (nr2 == 0) break; reset++; reset2++; cout << endl; nrcacat2 = 2 * n - 1; sex2 = 1 + reset2; nr2--; rand2 = 1; if (nr2 == 0) break; } if (nr2 == 0) break; } } } break; } cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } cout << endl; reset++; sex = 1; part2 = 1; } if (reset > 2 * n - 1) break; } } int linie = 2 * n, coloana = n, nrsex = 1; if (c == 3) { while (linie > 0) { if (coloana == 0) break; cout << nrsex; linie--; if (linie == 0) { linie = 2 * n; coloana--; nrsex++; cout << endl; } } } if (c == 4) { if (n == 1) cout << "1"; rand = n * 2 - 1; sex = n - 1; while (sex > 0) { cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } break; } } } return 0; }

                                                                                                                                                                                    ^
desen.cpp:2:253: error: 'cout' was not declared in this scope
 unsigned long long int sum(unsigned long long int a) { return a * (a + 1) / 2; } int main() { int c, n, vv, nr = 1, rand = 0, sex = 0, nrcacat = 0, nri = 1, reset = 0, copyn = 0; cin >> c >> n; vv = n; copyn = 2 * n - 1; if (c == 1) { while (vv > 0) { cout << nr; vv--; if (vv == 0 && nr < n) { vv = n; nr++; cout << endl; } } } int sex2 = 1, rand2 = 1, nrcacat2 = 2 * n - 1, reset2 = 0, part2 = 0, nr2 = n - 1; if (c == 2) { rand = n * 2 - 1; sex = n - 1; while (sex > 0) { if (nr2 == 0) break; if (part2 == 1) { if (nr2 == 0) break; while (reset >= n - 1 && reset <= (2 * n - 1)) { if (nr2 == 0) break; while (sex2 > 0) { if (nr2 == 0) break; cout << " "; nrcacat2--; rand2++; sex2--; if (sex2 == 0) { if (nr2 == 0) break; while (nrcacat2 >= rand2) { cout << nr2; nrcacat2--; } sex2 = nrcacat2; if (nrcacat2 == 0) { if (nr2 == 0) break; reset++; reset2++; cout << endl; nrcacat2 = 2 * n - 1; sex2 = 1 + reset2; nr2--; rand2 = 1; if (nr2 == 0) break; } if (nr2 == 0) break; } } } break; } cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } cout << endl; reset++; sex = 1; part2 = 1; } if (reset > 2 * n - 1) break; } } int linie = 2 * n, coloana = n, nrsex = 1; if (c == 3) { while (linie > 0) { if (coloana == 0) break; cout << nrsex; linie--; if (linie == 0) { linie = 2 * n; coloana--; nrsex++; cout << endl; } } } if (c == 4) { if (n == 1) cout << "1"; rand = n * 2 - 1; sex = n - 1; while (sex > 0) { cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } break; } } } return 0; }

                                                                                                                                                                                                                                                             ^
desen.cpp:2:318: error: 'endl' was not declared in this scope
 unsigned long long int sum(unsigned long long int a) { return a * (a + 1) / 2; } int main() { int c, n, vv, nr = 1, rand = 0, sex = 0, nrcacat = 0, nri = 1, reset = 0, copyn = 0; cin >> c >> n; vv = n; copyn = 2 * n - 1; if (c == 1) { while (vv > 0) { cout << nr; vv--; if (vv == 0 && nr < n) { vv = n; nr++; cout << endl; } } } int sex2 = 1, rand2 = 1, nrcacat2 = 2 * n - 1, reset2 = 0, part2 = 0, nr2 = n - 1; if (c == 2) { rand = n * 2 - 1; sex = n - 1; while (sex > 0) { if (nr2 == 0) break; if (part2 == 1) { if (nr2 == 0) break; while (reset >= n - 1 && reset <= (2 * n - 1)) { if (nr2 == 0) break; while (sex2 > 0) { if (nr2 == 0) break; cout << " "; nrcacat2--; rand2++; sex2--; if (sex2 == 0) { if (nr2 == 0) break; while (nrcacat2 >= rand2) { cout << nr2; nrcacat2--; } sex2 = nrcacat2; if (nrcacat2 == 0) { if (nr2 == 0) break; reset++; reset2++; cout << endl; nrcacat2 = 2 * n - 1; sex2 = 1 + reset2; nr2--; rand2 = 1; if (nr2 == 0) break; } if (nr2 == 0) break; } } } break; } cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } cout << endl; reset++; sex = 1; part2 = 1; } if (reset > 2 * n - 1) break; } } int linie = 2 * n, coloana = n, nrsex = 1; if (c == 3) { while (linie > 0) { if (coloana == 0) break; cout << nrsex; linie--; if (linie == 0) { linie = 2 * n; coloana--; nrsex++; cout << endl; } } } if (c == 4) { if (n == 1) cout << "1"; rand = n * 2 - 1; sex = n - 1; while (sex > 0) { cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } break; } } } return 0; }

                                                                                                                                                                                                                                                                                                                              ^
desen.cpp:2:646: error: 'cout' was not declared in this scope
 unsigned long long int sum(unsigned long long int a) { return a * (a + 1) / 2; } int main() { int c, n, vv, nr = 1, rand = 0, sex = 0, nrcacat = 0, nri = 1, reset = 0, copyn = 0; cin >> c >> n; vv = n; copyn = 2 * n - 1; if (c == 1) { while (vv > 0) { cout << nr; vv--; if (vv == 0 && nr < n) { vv = n; nr++; cout << endl; } } } int sex2 = 1, rand2 = 1, nrcacat2 = 2 * n - 1, reset2 = 0, part2 = 0, nr2 = n - 1; if (c == 2) { rand = n * 2 - 1; sex = n - 1; while (sex > 0) { if (nr2 == 0) break; if (part2 == 1) { if (nr2 == 0) break; while (reset >= n - 1 && reset <= (2 * n - 1)) { if (nr2 == 0) break; while (sex2 > 0) { if (nr2 == 0) break; cout << " "; nrcacat2--; rand2++; sex2--; if (sex2 == 0) { if (nr2 == 0) break; while (nrcacat2 >= rand2) { cout << nr2; nrcacat2--; } sex2 = nrcacat2; if (nrcacat2 == 0) { if (nr2 == 0) break; reset++; reset2++; cout << endl; nrcacat2 = 2 * n - 1; sex2 = 1 + reset2; nr2--; rand2 = 1; if (nr2 == 0) break; } if (nr2 == 0) break; } } } break; } cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } cout << endl; reset++; sex = 1; part2 = 1; } if (reset > 2 * n - 1) break; } } int linie = 2 * n, coloana = n, nrsex = 1; if (c == 3) { while (linie > 0) { if (coloana == 0) break; cout << nrsex; linie--; if (linie == 0) { linie = 2 * n; coloana--; nrsex++; cout << endl; } } } if (c == 4) { if (n == 1) cout << "1"; rand = n * 2 - 1; sex = n - 1; while (sex > 0) { cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } break; } } } return 0; }

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
desen.cpp:2:867: error: 'endl' was not declared in this scope
 unsigned long long int sum(unsigned long long int a) { return a * (a + 1) / 2; } int main() { int c, n, vv, nr = 1, rand = 0, sex = 0, nrcacat = 0, nri = 1, reset = 0, copyn = 0; cin >> c >> n; vv = n; copyn = 2 * n - 1; if (c == 1) { while (vv > 0) { cout << nr; vv--; if (vv == 0 && nr < n) { vv = n; nr++; cout << endl; } } } int sex2 = 1, rand2 = 1, nrcacat2 = 2 * n - 1, reset2 = 0, part2 = 0, nr2 = n - 1; if (c == 2) { rand = n * 2 - 1; sex = n - 1; while (sex > 0) { if (nr2 == 0) break; if (part2 == 1) { if (nr2 == 0) break; while (reset >= n - 1 && reset <= (2 * n - 1)) { if (nr2 == 0) break; while (sex2 > 0) { if (nr2 == 0) break; cout << " "; nrcacat2--; rand2++; sex2--; if (sex2 == 0) { if (nr2 == 0) break; while (nrcacat2 >= rand2) { cout << nr2; nrcacat2--; } sex2 = nrcacat2; if (nrcacat2 == 0) { if (nr2 == 0) break; reset++; reset2++; cout << endl; nrcacat2 = 2 * n - 1; sex2 = 1 + reset2; nr2--; rand2 = 1; if (nr2 == 0) break; } if (nr2 == 0) break; } } } break; } cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } cout << endl; reset++; sex = 1; part2 = 1; } if (reset > 2 * n - 1) break; } } int linie = 2 * n, coloana = n, nrsex = 1; if (c == 3) { while (linie > 0) { if (coloana == 0) break; cout << nrsex; linie--; if (linie == 0) { linie = 2 * n; coloana--; nrsex++; cout << endl; } } } if (c == 4) { if (n == 1) cout << "1"; rand = n * 2 - 1; sex = n - 1; while (sex > 0) { cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } break; } } } return 0; }

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   ^
desen.cpp:2:991: error: 'cout' was not declared in this scope
 unsigned long long int sum(unsigned long long int a) { return a * (a + 1) / 2; } int main() { int c, n, vv, nr = 1, rand = 0, sex = 0, nrcacat = 0, nri = 1, reset = 0, copyn = 0; cin >> c >> n; vv = n; copyn = 2 * n - 1; if (c == 1) { while (vv > 0) { cout << nr; vv--; if (vv == 0 && nr < n) { vv = n; nr++; cout << endl; } } } int sex2 = 1, rand2 = 1, nrcacat2 = 2 * n - 1, reset2 = 0, part2 = 0, nr2 = n - 1; if (c == 2) { rand = n * 2 - 1; sex = n - 1; while (sex > 0) { if (nr2 == 0) break; if (part2 == 1) { if (nr2 == 0) break; while (reset >= n - 1 && reset <= (2 * n - 1)) { if (nr2 == 0) break; while (sex2 > 0) { if (nr2 == 0) break; cout << " "; nrcacat2--; rand2++; sex2--; if (sex2 == 0) { if (nr2 == 0) break; while (nrcacat2 >= rand2) { cout << nr2; nrcacat2--; } sex2 = nrcacat2; if (nrcacat2 == 0) { if (nr2 == 0) break; reset++; reset2++; cout << endl; nrcacat2 = 2 * n - 1; sex2 = 1 + reset2; nr2--; rand2 = 1; if (nr2 == 0) break; } if (nr2 == 0) break; } } } break; } cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } cout << endl; reset++; sex = 1; part2 = 1; } if (reset > 2 * n - 1) break; } } int linie = 2 * n, coloana = n, nrsex = 1; if (c == 3) { while (linie > 0) { if (coloana == 0) break; cout << nrsex; linie--; if (linie == 0) { linie = 2 * n; coloana--; nrsex++; cout << endl; } } } if (c == 4) { if (n == 1) cout << "1"; rand = n * 2 - 1; sex = n - 1; while (sex > 0) { cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } break; } } } return 0; }

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ^
desen.cpp:2:1141: error: 'endl' was not declared in this scope
 unsigned long long int sum(unsigned long long int a) { return a * (a + 1) / 2; } int main() { int c, n, vv, nr = 1, rand = 0, sex = 0, nrcacat = 0, nri = 1, reset = 0, copyn = 0; cin >> c >> n; vv = n; copyn = 2 * n - 1; if (c == 1) { while (vv > 0) { cout << nr; vv--; if (vv == 0 && nr < n) { vv = n; nr++; cout << endl; } } } int sex2 = 1, rand2 = 1, nrcacat2 = 2 * n - 1, reset2 = 0, part2 = 0, nr2 = n - 1; if (c == 2) { rand = n * 2 - 1; sex = n - 1; while (sex > 0) { if (nr2 == 0) break; if (part2 == 1) { if (nr2 == 0) break; while (reset >= n - 1 && reset <= (2 * n - 1)) { if (nr2 == 0) break; while (sex2 > 0) { if (nr2 == 0) break; cout << " "; nrcacat2--; rand2++; sex2--; if (sex2 == 0) { if (nr2 == 0) break; while (nrcacat2 >= rand2) { cout << nr2; nrcacat2--; } sex2 = nrcacat2; if (nrcacat2 == 0) { if (nr2 == 0) break; reset++; reset2++; cout << endl; nrcacat2 = 2 * n - 1; sex2 = 1 + reset2; nr2--; rand2 = 1; if (nr2 == 0) break; } if (nr2 == 0) break; } } } break; } cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } cout << endl; reset++; sex = 1; part2 = 1; } if (reset > 2 * n - 1) break; } } int linie = 2 * n, coloana = n, nrsex = 1; if (c == 3) { while (linie > 0) { if (coloana == 0) break; cout << nrsex; linie--; if (linie == 0) { linie = 2 * n; coloana--; nrsex++; cout << endl; } } } if (c == 4) { if (n == 1) cout << "1"; rand = n * 2 - 1; sex = n - 1; while (sex > 0) { cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } break; } } } return 0; }

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     ^
desen.cpp:2:1280: error: 'endl' was not declared in this scope
 unsigned long long int sum(unsigned long long int a) { return a * (a + 1) / 2; } int main() { int c, n, vv, nr = 1, rand = 0, sex = 0, nrcacat = 0, nri = 1, reset = 0, copyn = 0; cin >> c >> n; vv = n; copyn = 2 * n - 1; if (c == 1) { while (vv > 0) { cout << nr; vv--; if (vv == 0 && nr < n) { vv = n; nr++; cout << endl; } } } int sex2 = 1, rand2 = 1, nrcacat2 = 2 * n - 1, reset2 = 0, part2 = 0, nr2 = n - 1; if (c == 2) { rand = n * 2 - 1; sex = n - 1; while (sex > 0) { if (nr2 == 0) break; if (part2 == 1) { if (nr2 == 0) break; while (reset >= n - 1 && reset <= (2 * n - 1)) { if (nr2 == 0) break; while (sex2 > 0) { if (nr2 == 0) break; cout << " "; nrcacat2--; rand2++; sex2--; if (sex2 == 0) { if (nr2 == 0) break; while (nrcacat2 >= rand2) { cout << nr2; nrcacat2--; } sex2 = nrcacat2; if (nrcacat2 == 0) { if (nr2 == 0) break; reset++; reset2++; cout << endl; nrcacat2 = 2 * n - 1; sex2 = 1 + reset2; nr2--; rand2 = 1; if (nr2 == 0) break; } if (nr2 == 0) break; } } } break; } cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } cout << endl; reset++; sex = 1; part2 = 1; } if (reset > 2 * n - 1) break; } } int linie = 2 * n, coloana = n, nrsex = 1; if (c == 3) { while (linie > 0) { if (coloana == 0) break; cout << nrsex; linie--; if (linie == 0) { linie = 2 * n; coloana--; nrsex++; cout << endl; } } } if (c == 4) { if (n == 1) cout << "1"; rand = n * 2 - 1; sex = n - 1; while (sex > 0) { cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } break; } } } return 0; }

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ^
desen.cpp:2:1453: error: 'cout' was not declared in this scope
 unsigned long long int sum(unsigned long long int a) { return a * (a + 1) / 2; } int main() { int c, n, vv, nr = 1, rand = 0, sex = 0, nrcacat = 0, nri = 1, reset = 0, copyn = 0; cin >> c >> n; vv = n; copyn = 2 * n - 1; if (c == 1) { while (vv > 0) { cout << nr; vv--; if (vv == 0 && nr < n) { vv = n; nr++; cout << endl; } } } int sex2 = 1, rand2 = 1, nrcacat2 = 2 * n - 1, reset2 = 0, part2 = 0, nr2 = n - 1; if (c == 2) { rand = n * 2 - 1; sex = n - 1; while (sex > 0) { if (nr2 == 0) break; if (part2 == 1) { if (nr2 == 0) break; while (reset >= n - 1 && reset <= (2 * n - 1)) { if (nr2 == 0) break; while (sex2 > 0) { if (nr2 == 0) break; cout << " "; nrcacat2--; rand2++; sex2--; if (sex2 == 0) { if (nr2 == 0) break; while (nrcacat2 >= rand2) { cout << nr2; nrcacat2--; } sex2 = nrcacat2; if (nrcacat2 == 0) { if (nr2 == 0) break; reset++; reset2++; cout << endl; nrcacat2 = 2 * n - 1; sex2 = 1 + reset2; nr2--; rand2 = 1; if (nr2 == 0) break; } if (nr2 == 0) break; } } } break; } cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } cout << endl; reset++; sex = 1; part2 = 1; } if (reset > 2 * n - 1) break; } } int linie = 2 * n, coloana = n, nrsex = 1; if (c == 3) { while (linie > 0) { if (coloana == 0) break; cout << nrsex; linie--; if (linie == 0) { linie = 2 * n; coloana--; nrsex++; cout << endl; } } } if (c == 4) { if (n == 1) cout << "1"; rand = n * 2 - 1; sex = n - 1; while (sex > 0) { cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } break; } } } return 0; }

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ^
desen.cpp:2:1538: error: 'endl' was not declared in this scope
 unsigned long long int sum(unsigned long long int a) { return a * (a + 1) / 2; } int main() { int c, n, vv, nr = 1, rand = 0, sex = 0, nrcacat = 0, nri = 1, reset = 0, copyn = 0; cin >> c >> n; vv = n; copyn = 2 * n - 1; if (c == 1) { while (vv > 0) { cout << nr; vv--; if (vv == 0 && nr < n) { vv = n; nr++; cout << endl; } } } int sex2 = 1, rand2 = 1, nrcacat2 = 2 * n - 1, reset2 = 0, part2 = 0, nr2 = n - 1; if (c == 2) { rand = n * 2 - 1; sex = n - 1; while (sex > 0) { if (nr2 == 0) break; if (part2 == 1) { if (nr2 == 0) break; while (reset >= n - 1 && reset <= (2 * n - 1)) { if (nr2 == 0) break; while (sex2 > 0) { if (nr2 == 0) break; cout << " "; nrcacat2--; rand2++; sex2--; if (sex2 == 0) { if (nr2 == 0) break; while (nrcacat2 >= rand2) { cout << nr2; nrcacat2--; } sex2 = nrcacat2; if (nrcacat2 == 0) { if (nr2 == 0) break; reset++; reset2++; cout << endl; nrcacat2 = 2 * n - 1; sex2 = 1 + reset2; nr2--; rand2 = 1; if (nr2 == 0) break; } if (nr2 == 0) break; } } } break; } cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } cout << endl; reset++; sex = 1; part2 = 1; } if (reset > 2 * n - 1) break; } } int linie = 2 * n, coloana = n, nrsex = 1; if (c == 3) { while (linie > 0) { if (coloana == 0) break; cout << nrsex; linie--; if (linie == 0) { linie = 2 * n; coloana--; nrsex++; cout << endl; } } } if (c == 4) { if (n == 1) cout << "1"; rand = n * 2 - 1; sex = n - 1; while (sex > 0) { cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } break; } } } return 0; }

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ^
desen.cpp:2:1576: error: 'cout' was not declared in this scope
 unsigned long long int sum(unsigned long long int a) { return a * (a + 1) / 2; } int main() { int c, n, vv, nr = 1, rand = 0, sex = 0, nrcacat = 0, nri = 1, reset = 0, copyn = 0; cin >> c >> n; vv = n; copyn = 2 * n - 1; if (c == 1) { while (vv > 0) { cout << nr; vv--; if (vv == 0 && nr < n) { vv = n; nr++; cout << endl; } } } int sex2 = 1, rand2 = 1, nrcacat2 = 2 * n - 1, reset2 = 0, part2 = 0, nr2 = n - 1; if (c == 2) { rand = n * 2 - 1; sex = n - 1; while (sex > 0) { if (nr2 == 0) break; if (part2 == 1) { if (nr2 == 0) break; while (reset >= n - 1 && reset <= (2 * n - 1)) { if (nr2 == 0) break; while (sex2 > 0) { if (nr2 == 0) break; cout << " "; nrcacat2--; rand2++; sex2--; if (sex2 == 0) { if (nr2 == 0) break; while (nrcacat2 >= rand2) { cout << nr2; nrcacat2--; } sex2 = nrcacat2; if (nrcacat2 == 0) { if (nr2 == 0) break; reset++; reset2++; cout << endl; nrcacat2 = 2 * n - 1; sex2 = 1 + reset2; nr2--; rand2 = 1; if (nr2 == 0) break; } if (nr2 == 0) break; } } } break; } cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } cout << endl; reset++; sex = 1; part2 = 1; } if (reset > 2 * n - 1) break; } } int linie = 2 * n, coloana = n, nrsex = 1; if (c == 3) { while (linie > 0) { if (coloana == 0) break; cout << nrsex; linie--; if (linie == 0) { linie = 2 * n; coloana--; nrsex++; cout << endl; } } } if (c == 4) { if (n == 1) cout << "1"; rand = n * 2 - 1; sex = n - 1; while (sex > 0) { cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } break; } } } return 0; }

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        ^
desen.cpp:2:1638: error: 'cout' was not declared in this scope
 unsigned long long int sum(unsigned long long int a) { return a * (a + 1) / 2; } int main() { int c, n, vv, nr = 1, rand = 0, sex = 0, nrcacat = 0, nri = 1, reset = 0, copyn = 0; cin >> c >> n; vv = n; copyn = 2 * n - 1; if (c == 1) { while (vv > 0) { cout << nr; vv--; if (vv == 0 && nr < n) { vv = n; nr++; cout << endl; } } } int sex2 = 1, rand2 = 1, nrcacat2 = 2 * n - 1, reset2 = 0, part2 = 0, nr2 = n - 1; if (c == 2) { rand = n * 2 - 1; sex = n - 1; while (sex > 0) { if (nr2 == 0) break; if (part2 == 1) { if (nr2 == 0) break; while (reset >= n - 1 && reset <= (2 * n - 1)) { if (nr2 == 0) break; while (sex2 > 0) { if (nr2 == 0) break; cout << " "; nrcacat2--; rand2++; sex2--; if (sex2 == 0) { if (nr2 == 0) break; while (nrcacat2 >= rand2) { cout << nr2; nrcacat2--; } sex2 = nrcacat2; if (nrcacat2 == 0) { if (nr2 == 0) break; reset++; reset2++; cout << endl; nrcacat2 = 2 * n - 1; sex2 = 1 + reset2; nr2--; rand2 = 1; if (nr2 == 0) break; } if (nr2 == 0) break; } } } break; } cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } cout << endl; reset++; sex = 1; part2 = 1; } if (reset > 2 * n - 1) break; } } int linie = 2 * n, coloana = n, nrsex = 1; if (c == 3) { while (linie > 0) { if (coloana == 0) break; cout << nrsex; linie--; if (linie == 0) { linie = 2 * n; coloana--; nrsex++; cout << endl; } } } if (c == 4) { if (n == 1) cout << "1"; rand = n * 2 - 1; sex = n - 1; while (sex > 0) { cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } break; } } } return 0; }

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ^
desen.cpp:2:1788: error: 'endl' was not declared in this scope
 unsigned long long int sum(unsigned long long int a) { return a * (a + 1) / 2; } int main() { int c, n, vv, nr = 1, rand = 0, sex = 0, nrcacat = 0, nri = 1, reset = 0, copyn = 0; cin >> c >> n; vv = n; copyn = 2 * n - 1; if (c == 1) { while (vv > 0) { cout << nr; vv--; if (vv == 0 && nr < n) { vv = n; nr++; cout << endl; } } } int sex2 = 1, rand2 = 1, nrcacat2 = 2 * n - 1, reset2 = 0, part2 = 0, nr2 = n - 1; if (c == 2) { rand = n * 2 - 1; sex = n - 1; while (sex > 0) { if (nr2 == 0) break; if (part2 == 1) { if (nr2 == 0) break; while (reset >= n - 1 && reset <= (2 * n - 1)) { if (nr2 == 0) break; while (sex2 > 0) { if (nr2 == 0) break; cout << " "; nrcacat2--; rand2++; sex2--; if (sex2 == 0) { if (nr2 == 0) break; while (nrcacat2 >= rand2) { cout << nr2; nrcacat2--; } sex2 = nrcacat2; if (nrcacat2 == 0) { if (nr2 == 0) break; reset++; reset2++; cout << endl; nrcacat2 = 2 * n - 1; sex2 = 1 + reset2; nr2--; rand2 = 1; if (nr2 == 0) break; } if (nr2 == 0) break; } } } break; } cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } cout << endl; reset++; sex = 1; part2 = 1; } if (reset > 2 * n - 1) break; } } int linie = 2 * n, coloana = n, nrsex = 1; if (c == 3) { while (linie > 0) { if (coloana == 0) break; cout << nrsex; linie--; if (linie == 0) { linie = 2 * n; coloana--; nrsex++; cout << endl; } } } if (c == 4) { if (n == 1) cout << "1"; rand = n * 2 - 1; sex = n - 1; while (sex > 0) { cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } break; } } } return 0; }

                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            ^
desen.cpp:2:149: warning: unused variable 'nri' [-Wunused-variable]
 unsigned long long int sum(unsigned long long int a) { return a * (a + 1) / 2; } int main() { int c, n, vv, nr = 1, rand = 0, sex = 0, nrcacat = 0, nri = 1, reset = 0, copyn = 0; cin >> c >> n; vv = n; copyn = 2 * n - 1; if (c == 1) { while (vv > 0) { cout << nr; vv--; if (vv == 0 && nr < n) { vv = n; nr++; cout << endl; } } } int sex2 = 1, rand2 = 1, nrcacat2 = 2 * n - 1, reset2 = 0, part2 = 0, nr2 = n - 1; if (c == 2) { rand = n * 2 - 1; sex = n - 1; while (sex > 0) { if (nr2 == 0) break; if (part2 == 1) { if (nr2 == 0) break; while (reset >= n - 1 && reset <= (2 * n - 1)) { if (nr2 == 0) break; while (sex2 > 0) { if (nr2 == 0) break; cout << " "; nrcacat2--; rand2++; sex2--; if (sex2 == 0) { if (nr2 == 0) break; while (nrcacat2 >= rand2) { cout << nr2; nrcacat2--; } sex2 = nrcacat2; if (nrcacat2 == 0) { if (nr2 == 0) break; reset++; reset2++; cout << endl; nrcacat2 = 2 * n - 1; sex2 = 1 + reset2; nr2--; rand2 = 1; if (nr2 == 0) break; } if (nr2 == 0) break; } } } break; } cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } cout << endl; reset++; sex = 1; part2 = 1; } if (reset > 2 * n - 1) break; } } int linie = 2 * n, coloana = n, nrsex = 1; if (c == 3) { while (linie > 0) { if (coloana == 0) break; cout << nrsex; linie--; if (linie == 0) { linie = 2 * n; coloana--; nrsex++; cout << endl; } } } if (c == 4) { if (n == 1) cout << "1"; rand = n * 2 - 1; sex = n - 1; while (sex > 0) { cout << " "; nrcacat++; rand--; sex--; if (sex == 0) { while (rand > nrcacat) { cout << nr; rand--; } sex = rand; } if (rand == 0) { reset++; cout << endl; rand = n * 2 - 1; sex = n - 1 - reset; nrcacat = 0; nr++; } if (reset == n - 1) { while (copyn > 0) { cout << nr; copyn--; } break; } } } return 0; }

                                                                                                                                                     ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema Desen face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.