#3970
sum_prod
Scrie un program care pentru un număr natural nenul n
, găsește numărul de secvențe de numere naturale nenule a1, a2, a3,..., an
, astfel încât a1 * a2 * a3 *...* an = a1 + a2 + a3 +...+ an
și a1 ≥ a2 ≥ a3 ≥...≥ an
.
Turneul Internațional Shumen 2021
Problema | sum_prod | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 2.6 secunde | Limita memorie |
Total: 256 MB
/
Stivă 128 MB
|
Id soluție | #44189766 | Utilizator | |
Fișier | sum_prod.cpp | Dimensiune | 2.15 KB |
Data încărcării | 08 Iulie 2023, 15:03 | Scor / rezultat | Eroare de compilare |
sum_prod.cpp:9:12: error: '__int128_t' does not name a type #define ll __int128_t ^ sum_prod.cpp:13:5: note: in expansion of macro 'll' ll nr; ^ sum_prod.cpp:9:12: error: '__int128_t' does not name a type #define ll __int128_t ^ sum_prod.cpp:17:1: note: in expansion of macro 'll' ll pr = 1, suma = 0; ^ sum_prod.cpp:9:12: error: '__int128_t' does not name a type #define ll __int128_t ^ sum_prod.cpp:18:1: note: in expansion of macro 'll' ll fastPow[MAXPOWNR+5][MAXPOWEXP+2]; ^ sum_prod.cpp: In function 'void computeFastPow()': sum_prod.cpp:9:12: error: '__int128_t' was not declared in this scope #define ll __int128_t ^ sum_prod.cpp:23:10: note: in expansion of macro 'll' for (ll x = 0; x <= MAXPOWNR; x++) { ^ sum_prod.cpp:23:13: error: expected ';' before 'x' for (ll x = 0; x <= MAXPOWNR; x++) { ^ sum_prod.cpp:23:20: error: 'x' was not declared in this scope for (ll x = 0; x <= MAXPOWNR; x++) { ^ sum_prod.cpp:24:9: error: 'fastPow' was not declared in this scope fastPow[x][0] = 1; ^ sum_prod.cpp:25:12: error: expected ';' before 'aux' ll aux = 1; ^ sum_prod.cpp:26:12: error: expected ';' before 'e' ll e = 0; ^ sum_prod.cpp:27:14: error: 'e' was not declared in this scope for (e = 1; e <= MAXPOWEXP; e++) { ^ sum_prod.cpp:28:13: error: 'aux' was not declared in this scope aux = aux * x; ^ sum_prod.cpp:33:16: error: 'e' was not declared in this scope for (; e <= MAXPOWEXP; e++) { ^ sum_prod.cpp: At global scope: sum_prod.cpp:9:12: error: '__int128_t' does not name a type #define ll __int128_t ^ sum_prod.cpp:39:1: note: in expansion of macro 'll' ll getPow(ll x, ll e) ^ sum_prod.cpp: In function 'int main()': sum_prod.cpp:67:5: error: 'pr' was not declared in this scope pr = 1; ^ sum_prod.cpp:68:5: error: 'suma' was not declared in this scope suma = n - bktcnt; ^ sum_prod.cpp:69:10: error: 'struct BktData' has no member named 'nr' v[0].nr = 1; ^ sum_prod.cpp:77:16: error: 'struct BktData' has no member named 'nr' v[curstep].nr = 1; ^ sum_prod.cpp:84:30: error: 'struct BktData' has no member named 'nr' pr /= v[curstep].nr; ^ sum_prod.cpp:85:32: error: 'struct BktData' has no member named 'nr' suma -= v[curstep].nr; ^ sum_prod.cpp:86:24: error: 'struct BktData' has no member named 'nr' v[curstep].nr++; ^ sum_prod.cpp:88:36: error: 'struct BktData' has no member named 'nr' if (pr * getPow(v[curstep].nr, bktcnt-curstep+1) > suma + v[curstep].nr * (bktcnt-curstep+1)) { ^ sum_prod.cpp:88:56: error: 'getPow' was not declared in this scope if (pr * getPow(v[curstep].nr, bktcnt-curstep+1) > suma + v[curstep].nr * (bktcnt-curstep+1)) { ^ sum_prod.cpp:88:78: error: 'struct BktData' has no member named 'nr' if (pr * getPow(v[curstep].nr, bktcnt-curstep+1) > suma + v[curstep].nr * (bktcnt-curstep+1)) { ^ sum_prod.cpp:90:30: error: 'struct BktData' has no member named 'nr' pr /= v[curstep].nr; ^ sum_prod.cpp:91:32: error: 'struct BktData' has no member named 'nr' suma -= v[curstep].nr; ^ sum_prod.cpp:92:24: error: 'struct BktData' has no member named 'nr' v[curstep].nr++; ^ sum_prod.cpp:95:38: error: 'struct BktData' has no member named 'nr' suma = suma + v[curstep].nr; ^ sum_prod.cpp:96:34: error: 'struct BktData' has no member named 'nr' pr = pr * v[curstep].nr; ^ sum_prod.cpp:97:26: error: 'struct BktData' has no member named 'nr' v[curstep+1].nr = v[curstep].nr; ^ sum_prod.cpp:97:42: error: 'struct BktData' has no member named 'nr' v[curstep+1].nr = v[curstep].nr; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sum_prod face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
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ă.