Detalii evaluare #54831421

Rezumat problemă

#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 D10 = {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.

Detalii

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 ungureanu stefan (tanutete)
Fișier forta.c Dimensiune 1.84 KB
Data încărcării 09 Decembrie 2024, 20:53 Scor / rezultat Eroare de compilare

Evaluare


Mesaj 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]);

              ^

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 Forta 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ă.