#3433
Forta
Forța unui număr natural nenul X
este egală cu numărul de divizori pozitivi ai lui X
. De exemplu, numărul X = 10
are forţa 4
, deoarece 10
are 4
divizori, mulțimea divizorilor fiind D
10
= {1,2,5,10}
.
Scrieţi un program care, cunoscând un șir de n
numere naturale nenule, rezolvă următoarele cerințe:
1. determină cel mai mic număr din șir care are forța maximă;
2. determină lungimea maximă a unei secvențe formată din numere cu aceeași forţă ce poate fi obținută prin rearanjarea convenabilă a elementelor din șir.
OJI 2020, clasa a VI-a
Problema | Forta | Operații I/O |
forta.in /forta.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 16 MB
/
Stivă 8 MB
|
Id soluție | #54831421 | Utilizator | |
Fișier | forta.c | Dimensiune | 1.84 KB |
Data încărcării | 09 Decembrie 2024, 20:53 | Scor / rezultat | Eroare de compilare |
forta.c: In function 'main': forta.c:34:13: error: expected identifier or '(' before 'for' int forță_maximă = 0; ^ forta.c:34:13: error: stray '\310' in program forta.c:34:13: error: stray '\233' in program forta.c:34:13: error: stray '\304' in program forta.c:34:13: error: stray '\203' in program forta.c:34:13: error: stray '\304' in program forta.c:34:13: error: stray '\203' in program forta.c:38:17: error: expected identifier or '(' before 'for' int forță = calculeaza_forta(numere[i]); ^ forta.c:38:17: error: stray '\310' in program forta.c:38:17: error: stray '\233' in program forta.c:38:17: error: stray '\304' in program forta.c:38:17: error: stray '\203' in program forta.c:39:17: error: expected expression before 'for' if (forță > forță_maximă || (forță == forță_maximă && numere[i] < numar_minim)) { ^ forta.c:39:17: error: stray '\310' in program forta.c:39:17: error: stray '\233' in program forta.c:39:17: error: stray '\304' in program forta.c:39:17: error: stray '\203' in program forta.c:39:17: error: stray '\310' in program forta.c:39:17: error: stray '\233' in program forta.c:39:17: error: stray '\304' in program forta.c:39:17: error: stray '\203' in program forta.c:39:17: error: stray '\304' in program forta.c:39:17: error: stray '\203' in program forta.c:39:17: error: stray '\310' in program forta.c:39:17: error: stray '\233' in program forta.c:39:17: error: stray '\304' in program forta.c:39:17: error: stray '\203' in program forta.c:39:17: error: stray '\310' in program forta.c:39:17: error: stray '\233' in program forta.c:39:17: error: stray '\304' in program forta.c:39:17: error: stray '\203' in program forta.c:39:17: error: stray '\304' in program forta.c:39:17: error: stray '\203' in program forta.c:40:17: error: stray '\310' in program forță_maximă = forță; ^ forta.c:40:17: error: stray '\233' in program forta.c:40:17: error: stray '\304' in program forta.c:40:17: error: stray '\203' in program forta.c:40:24: error: expected '(' before '_maxim' forță_maximă = forță; ^ forta.c:40:24: error: stray '\304' in program forta.c:40:24: error: stray '\203' in program forta.c:40:24: error: '_maxim' undeclared (first use in this function) forta.c:40:24: note: each undeclared identifier is reported only once for each function it appears in forta.c:40:24: error: stray '\310' in program forta.c:40:24: error: stray '\233' in program forta.c:40:24: error: stray '\304' in program forta.c:40:24: error: stray '\203' in program forta.c:49:9: error: stray '\310' in program int hist_forță[MAX_N + 1] = {0}; // Histogramă pentru frecvența forțelor ^ forta.c:49:9: error: stray '\233' in program forta.c:49:9: error: stray '\304' in program forta.c:49:9: error: stray '\203' in program forta.c:50:13: error: expected identifier or '(' before 'for' int forță_maximă = 0; ^ forta.c:50:13: error: stray '\310' in program forta.c:50:13: error: stray '\233' in program forta.c:50:13: error: stray '\304' in program forta.c:50:13: error: stray '\203' in program forta.c:50:13: error: stray '\304' in program forta.c:50:13: error: stray '\203' in program forta.c:54:17: error: expected identifier or '(' before 'for' int forță = calculeaza_forta(numere[i]); ^ forta.c:54:17: error: stray '\310' in program forta.c:54:17: error: stray '\233' in program forta.c:54:17: error: stray '\304' in program forta.c:54:17: error: stray '\203' in program forta.c:55:13: error: stray '\310' in program hist_forță[forță]++; ^ forta.c:55:13: error: stray '\233' in program forta.c:55:13: error: stray '\304' in program forta.c:55:13: error: stray '\203' in program forta.c:55:26: error: expected expression before 'for' hist_forță[forță]++; ^ forta.c:55:26: error: stray '\310' in program forta.c:55:26: error: stray '\233' in program forta.c:55:26: error: stray '\304' in program forta.c:55:26: error: stray '\203' in program forta.c:56:17: error: expected expression before 'for' if (forță > forță_maximă) { ^ forta.c:56:17: error: stray '\310' in program forta.c:56:17: error: stray '\233' in program forta.c:56:17: error: stray '\304' in program forta.c:56:17: error: stray '\203' in program forta.c:56:17: error: stray '\310' in program forta.c:56:17: error: stray '\233' in program forta.c:56:17: error: stray '\304' in program forta.c:56:17: error: stray '\203' in program forta.c:56:17: error: stray '\304' in program forta.c:56:17: error: stray '\203' in program forta.c:57:17: error: stray '\310' in program forță_maximă = forță; ^ forta.c:57:17: error: stray '\233' in program forta.c:57:17: error: stray '\304' in program forta.c:57:17: error: stray '\203' in program forta.c:57:24: error: expected '(' before '_maxim' forță_maximă = forță; ^ forta.c:57:24: error: stray '\304' in program forta.c:57:24: error: stray '\203' in program forta.c:57:24: error: stray '\310' in program forta.c:57:24: error: stray '\233' in program forta.c:57:24: error: stray '\304' in program forta.c:57:24: error: stray '\203' in program forta.c:62:9: error: stray '\310' in program printf("%d\n", hist_forță[forță_maximă]); ^ forta.c:62:9: error: stray '\233' in program forta.c:62:9: error: stray '\304' in program forta.c:62:9: error: stray '\203' in program forta.c:62:37: error: expected expression before 'for' printf("%d\n", hist_forță[forță_maximă]); ^ forta.c:62:37: error: stray '\310' in program forta.c:62:37: error: stray '\233' in program forta.c:62:37: error: stray '\304' in program forta.c:62:37: error: stray '\203' in program forta.c:62:37: error: stray '\304' in program forta.c:62:37: error: stray '\203' in program forta.c:49:13: warning: variable 'hist_for' set but not used [-Wunused-but-set-variable] int hist_forță[MAX_N + 1] = {0}; // Histogramă pentru frecvența forțelor ^ forta.c:24:10: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &c); ^ forta.c:25:10: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &n); ^ forta.c:29:14: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &numere[i]); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Forta 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ă.