Detalii evaluare #49814426

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 #49814426 Utilizator Ghilencea Mario (marioghil12345)
Fișier forta.cpp Dimensiune 1.98 KB
Data încărcării 15 Martie 2024, 16:49 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

forta.cpp:9:1: error: stray '\310' in program
 int calculForță(int număr) {

 ^
forta.cpp:9:1: error: stray '\233' in program
forta.cpp:9:1: error: stray '\304' in program
forta.cpp:9:1: error: stray '\203' in program
forta.cpp:9:1: error: stray '\304' in program
forta.cpp:9:1: error: stray '\203' in program
forta.cpp:10:5: error: stray '\310' in program
     int forță = 0;

     ^
forta.cpp:10:5: error: stray '\233' in program
forta.cpp:10:5: error: stray '\304' in program
forta.cpp:10:5: error: stray '\203' in program
forta.cpp:11:5: error: stray '\304' in program
     for (int i = 1; i * i <= număr; ++i) {

     ^
forta.cpp:11:5: error: stray '\203' in program
forta.cpp:12:9: error: stray '\304' in program
         if (număr % i == 0) {

         ^
forta.cpp:12:9: error: stray '\203' in program
forta.cpp:14:13: error: stray '\304' in program
             if (i * i == număr) {

             ^
forta.cpp:14:13: error: stray '\203' in program
forta.cpp:15:17: error: stray '\310' in program
                 forță++;

                 ^
forta.cpp:15:17: error: stray '\233' in program
forta.cpp:15:17: error: stray '\304' in program
forta.cpp:15:17: error: stray '\203' in program
forta.cpp:17:17: error: stray '\310' in program
                 forță += 2;

                 ^
forta.cpp:17:17: error: stray '\233' in program
forta.cpp:17:17: error: stray '\304' in program
forta.cpp:17:17: error: stray '\203' in program
forta.cpp:21:5: error: stray '\310' in program
     return forță;

     ^
forta.cpp:21:5: error: stray '\233' in program
forta.cpp:21:5: error: stray '\304' in program
forta.cpp:21:5: error: stray '\203' in program
forta.cpp:28:5: error: stray '\310' in program
     int cerință;

     ^
forta.cpp:28:5: error: stray '\233' in program
forta.cpp:28:5: error: stray '\304' in program
forta.cpp:28:5: error: stray '\203' in program
forta.cpp:29:5: error: stray '\310' in program
     cin >> cerință;

     ^
forta.cpp:29:5: error: stray '\233' in program
forta.cpp:29:5: error: stray '\304' in program
forta.cpp:29:5: error: stray '\203' in program
forta.cpp:35:5: error: stray '\310' in program
     unordered_map<int, int> forțe; // pentru a memora numărul de apariții ale fiecărei forțe

     ^
forta.cpp:35:5: error: stray '\233' in program
forta.cpp:39:9: error: stray '\310' in program
         forțe[calculForță(numere[i])]++; // calculăm forța fiecărui număr și memorăm numărul de apariții

         ^
forta.cpp:39:9: error: stray '\233' in program
forta.cpp:39:9: error: stray '\310' in program
forta.cpp:39:9: error: stray '\233' in program
forta.cpp:39:9: error: stray '\304' in program
forta.cpp:39:9: error: stray '\203' in program
forta.cpp:42:5: error: stray '\310' in program
     if (cerință == 1) {

     ^
forta.cpp:42:5: error: stray '\233' in program
forta.cpp:42:5: error: stray '\304' in program
forta.cpp:42:5: error: stray '\203' in program
forta.cpp:44:9: error: stray '\310' in program
         int maximForță = 0;

         ^
forta.cpp:44:9: error: stray '\233' in program
forta.cpp:44:9: error: stray '\304' in program
forta.cpp:44:9: error: stray '\203' in program
forta.cpp:45:9: error: stray '\310' in program
         for (auto it : forțe) {

         ^
forta.cpp:45:9: error: stray '\233' in program
forta.cpp:46:13: error: stray '\310' in program
             maximForță = max(maximForță, it.first);

             ^
forta.cpp:46:13: error: stray '\233' in program
forta.cpp:46:13: error: stray '\304' in program
forta.cpp:46:13: error: stray '\203' in program
forta.cpp:46:13: error: stray '\310' in program
forta.cpp:46:13: error: stray '\233' in program
forta.cpp:46:13: error: stray '\304' in program
forta.cpp:46:13: error: stray '\203' in program
forta.cpp:50:9: error: stray '\304' in program
         int minimNumărForțăMaximă = numeric_limits<int>::max();

         ^
forta.cpp:50:9: error: stray '\203' in program
forta.cpp:50:9: error: stray '\310' in program
forta.cpp:50:9: error: stray '\233' in program
forta.cpp:50:9: error: stray '\304' in program
forta.cpp:50:9: error: stray '\203' in program
forta.cpp:50:9: error: stray '\304' in program
forta.cpp:50:9: error: stray '\203' in program
forta.cpp:52:13: error: stray '\310' in program
             if (calculForță(numere[i]) == maximForță) {

             ^
forta.cpp:52:13: error: stray '\233' in program
forta.cpp:52:13: error: stray '\304' in program
forta.cpp:52:13: error: stray '\203' in program
forta.cpp:52:13: error: stray '\310' in program
forta.cpp:52:13: error: stray '\233' in program
forta.cpp:52:13: error: stray '\304' in program
forta.cpp:52:13: error: stray '\203' in program
forta.cpp:53:17: error: stray '\304' in program
                 minimNumărForțăMaximă = min(minimNumărForțăMaximă, numere[i]);

                 ^
forta.cpp:53:17: error: stray '\203' in program
forta.cpp:53:17: error: stray '\310' in program
forta.cpp:53:17: error: stray '\233' in program
forta.cpp:53:17: error: stray '\304' in program
forta.cpp:53:17: error: stray '\203' in program
forta.cpp:53:17: error: stray '\304' in program
forta.cpp:53:17: error: stray '\203' in program
forta.cpp:53:17: error: stray '\304' in program
forta.cpp:53:17: error: stray '\203' in program
forta.cpp:53:17: error: stray '\310' in program
forta.cpp:53:17: error: stray '\233' in program
forta.cpp:53:17: error: stray '\304' in program
forta.cpp:53:17: error: stray '\203' in program
forta.cpp:53:17: error: stray '\304' in program
forta.cpp:53:17: error: stray '\203' in program
forta.cpp:56:9: error: stray '\304' in program
         cout << minimNumărForțăMaximă << endl;

         ^
forta.cpp:56:9: error: stray '\203' in program
forta.cpp:56:9: error: stray '\310' in program
forta.cpp:56:9: error: stray '\233' in program
forta.cpp:56:9: error: stray '\304' in program
forta.cpp:56:9: error: stray '\203' in program
forta.cpp:56:9: error: stray '\304' in program
forta.cpp:56:9: error: stray '\203' in program
forta.cpp:57:5: error: stray '\310' in program
     } else if (cerință == 2) {

     ^
forta.cpp:57:5: error: stray '\233' in program
forta.cpp:57:5: error: stray '\304' in program
forta.cpp:57:5: error: stray '\203' in program
forta.cpp:59:9: error: stray '\304' in program
         int lungimeMaximă = 0;

         ^
forta.cpp:59:9: error: stray '\203' in program
forta.cpp:60:9: error: stray '\310' in program
         for (auto it : forțe) {

         ^
forta.cpp:60:9: error: stray '\233' in program
forta.cpp:61:13: error: stray '\304' in program
             lungimeMaximă = max(lungimeMaximă, it.second);

             ^
forta.cpp:61:13: error: stray '\203' in program
forta.cpp:61:13: error: stray '\304' in program
forta.cpp:61:13: error: stray '\203' in program
forta.cpp:63:9: error: stray '\304' in program
         cout << lungimeMaximă << endl;

         ^
forta.cpp:63:9: error: stray '\203' in program
forta.cpp:9:28: error: expected ',' or '...' before 'r'
 int calculForță(int număr) {

                            ^
forta.cpp: In function 'int calculFor(int)':
forta.cpp:10:9: error: expected unqualified-id before 'for'
     int forță = 0;

         ^
forta.cpp:11:35: error: expected ';' before 'r'
     for (int i = 1; i * i <= număr; ++i) {

                                   ^
forta.cpp:11:35: error: 'r' was not declared in this scope
forta.cpp:11:36: error: expected ')' before ';' token
     for (int i = 1; i * i <= număr; ++i) {

                                    ^
forta.cpp:11:40: error: 'i' was not declared in this scope
     for (int i = 1; i * i <= număr; ++i) {

                                        ^
forta.cpp:11:41: error: expected ';' before ')' token
     for (int i = 1; i * i <= număr; ++i) {

                                         ^
forta.cpp:67:1: error: expected '}' at end of input
 }

 ^
forta.cpp:67:1: warning: no return statement in function returning non-void [-Wreturn-type]

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