#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 | tastatură/ecran |
---|---|---|---|
Limita timp | 2.6 secunde | Limita memorie |
Total: 256 MB
/
Stivă 128 MB
|
Id soluție | #44189761 | Utilizator | |
Fișier | sum_prod.cpp | Dimensiune | 2.18 KB |
Data încărcării | 08 Iulie 2023, 15:02 | Scor / rezultat | Eroare de compilare |
sum_prod.cpp:11:12: error: '__int128_t' does not name a type #define ll __int128_t ^ sum_prod.cpp:15:5: note: in expansion of macro 'll' ll nr; ^ sum_prod.cpp:11:12: error: '__int128_t' does not name a type #define ll __int128_t ^ sum_prod.cpp:19:1: note: in expansion of macro 'll' ll pr = 1, suma = 0; ^ sum_prod.cpp:11:12: error: '__int128_t' does not name a type #define ll __int128_t ^ sum_prod.cpp:20:1: note: in expansion of macro 'll' ll fastPow[MAXPOWNR+5][MAXPOWEXP+2]; ^ sum_prod.cpp: In function 'void computeFastPow()': sum_prod.cpp:11:12: error: '__int128_t' was not declared in this scope #define ll __int128_t ^ sum_prod.cpp:25:10: note: in expansion of macro 'll' for (ll x = 0; x <= MAXPOWNR; x++) { ^ sum_prod.cpp:25:13: error: expected ';' before 'x' for (ll x = 0; x <= MAXPOWNR; x++) { ^ sum_prod.cpp:25:20: error: 'x' was not declared in this scope for (ll x = 0; x <= MAXPOWNR; x++) { ^ sum_prod.cpp:26:9: error: 'fastPow' was not declared in this scope fastPow[x][0] = 1; ^ sum_prod.cpp:27:12: error: expected ';' before 'aux' ll aux = 1; ^ sum_prod.cpp:28:12: error: expected ';' before 'e' ll e = 0; ^ sum_prod.cpp:29:14: error: 'e' was not declared in this scope for (e = 1; e <= MAXPOWEXP; e++) { ^ sum_prod.cpp:30:13: error: 'aux' was not declared in this scope aux = aux * x; ^ sum_prod.cpp:35:16: error: 'e' was not declared in this scope for (; e <= MAXPOWEXP; e++) { ^ sum_prod.cpp: At global scope: sum_prod.cpp:11:12: error: '__int128_t' does not name a type #define ll __int128_t ^ sum_prod.cpp:41:1: note: in expansion of macro 'll' ll getPow(ll x, ll e) ^ sum_prod.cpp: In function 'int main()': sum_prod.cpp:69:5: error: 'pr' was not declared in this scope pr = 1; ^ sum_prod.cpp:70:5: error: 'suma' was not declared in this scope suma = n - bktcnt; ^ sum_prod.cpp:71:10: error: 'struct BktData' has no member named 'nr' v[0].nr = 1; ^ sum_prod.cpp:79:16: error: 'struct BktData' has no member named 'nr' v[curstep].nr = 1; ^ sum_prod.cpp:86:30: error: 'struct BktData' has no member named 'nr' pr /= v[curstep].nr; ^ sum_prod.cpp:87:32: error: 'struct BktData' has no member named 'nr' suma -= v[curstep].nr; ^ sum_prod.cpp:88:24: error: 'struct BktData' has no member named 'nr' v[curstep].nr++; ^ sum_prod.cpp:90: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:90: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:90: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:92:30: error: 'struct BktData' has no member named 'nr' pr /= v[curstep].nr; ^ sum_prod.cpp:93:32: error: 'struct BktData' has no member named 'nr' suma -= v[curstep].nr; ^ sum_prod.cpp:94:24: error: 'struct BktData' has no member named 'nr' v[curstep].nr++; ^ sum_prod.cpp:97:38: error: 'struct BktData' has no member named 'nr' suma = suma + v[curstep].nr; ^ sum_prod.cpp:98:34: error: 'struct BktData' has no member named 'nr' pr = pr * v[curstep].nr; ^ sum_prod.cpp:99:26: error: 'struct BktData' has no member named 'nr' v[curstep+1].nr = v[curstep].nr; ^ sum_prod.cpp:99: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ă.