Detalii evaluare #45128915

Rezumat problemă

Gigel are un șir cu n elemente, numere naturale. Plictisit, el construiește un nou șir, prin scrierea repetată a valorilor șirului dat. De exemplu, dacă șirul inițial este (2 3 1 5), scriindu-l de 3 ori se obține șirul: (2 3 1 5 2 3 1 5 2 3 1 5).

Maleficul Costel elimină sau chiar schimbă unele valori din șirul al doilea. Acum Gigel vă pune la dispoziție două șiruri de numere naturale și roagă să stabiliți dacă al doilea șir poate obține prin scrierea repetată a primului șir și eliminarea unor elemente iar în caz afirmativ care este numărul minim de repetări ale primului șir prin care se poate obține șirul al doilea.

Detalii

Problema Repetare Operații I/O repetare.in/repetare.out
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #45128915 Utilizator Popescu Andrei (Popescu_Andrei8475524)
Fișier repetare.c Dimensiune 916 B
Data încărcării 03 Octombrie 2023, 15:10 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

repetare.c: In function 'main':
repetare.c:7:5: warning: passing argument 1 of 'fscanf' from incompatible pointer type [enabled by default]
     fscanf("%d", &n);

     ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from repetare.c:1:
/usr/include/stdio.h:443:12: note: expected 'struct FILE * restrict' but argument is of type 'char *'
 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
            ^
repetare.c:7:5: warning: passing argument 2 of 'fscanf' from incompatible pointer type [enabled by default]
     fscanf("%d", &n);

     ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from repetare.c:1:
/usr/include/stdio.h:443:12: note: expected 'const char * restrict' but argument is of type 'int *'
 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
            ^
repetare.c:7:5: warning: format not a string literal and no format arguments [-Wformat-security]
     fscanf("%d", &n);

     ^
repetare.c:9:9: warning: passing argument 1 of 'fscanf' from incompatible pointer type [enabled by default]
         fscanf("%d", &a[1]);

         ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from repetare.c:1:
/usr/include/stdio.h:443:12: note: expected 'struct FILE * restrict' but argument is of type 'char *'
 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
            ^
repetare.c:9:9: warning: passing argument 2 of 'fscanf' from incompatible pointer type [enabled by default]
         fscanf("%d", &a[1]);

         ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from repetare.c:1:
/usr/include/stdio.h:443:12: note: expected 'const char * restrict' but argument is of type 'int *'
 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
            ^
repetare.c:9:9: warning: format not a string literal and no format arguments [-Wformat-security]
         fscanf("%d", &a[1]);

         ^
repetare.c:10:5: warning: passing argument 1 of 'fscanf' from incompatible pointer type [enabled by default]
     fscanf("%d", &m);

     ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from repetare.c:1:
/usr/include/stdio.h:443:12: note: expected 'struct FILE * restrict' but argument is of type 'char *'
 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
            ^
repetare.c:10:5: warning: passing argument 2 of 'fscanf' from incompatible pointer type [enabled by default]
     fscanf("%d", &m);

     ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from repetare.c:1:
/usr/include/stdio.h:443:12: note: expected 'const char * restrict' but argument is of type 'int *'
 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
            ^
repetare.c:10:5: warning: format not a string literal and no format arguments [-Wformat-security]
     fscanf("%d", &m);

     ^
repetare.c:12:9: warning: passing argument 1 of 'fscanf' from incompatible pointer type [enabled by default]
         fscanf("%d", &b[1]);

         ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from repetare.c:1:
/usr/include/stdio.h:443:12: note: expected 'struct FILE * restrict' but argument is of type 'char *'
 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
            ^
repetare.c:12:9: warning: passing argument 2 of 'fscanf' from incompatible pointer type [enabled by default]
         fscanf("%d", &b[1]);

         ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdio.h:27,
                 from repetare.c:1:
/usr/include/stdio.h:443:12: note: expected 'const char * restrict' but argument is of type 'int *'
 extern int __REDIRECT (fscanf, (FILE *__restrict __stream,
            ^
repetare.c:12:9: warning: format not a string literal and no format arguments [-Wformat-security]
         fscanf("%d", &b[1]);

         ^
repetare.c:37:9: warning: passing argument 1 of 'fprintf' from incompatible pointer type [enabled by default]
         fprintf("%d", c+1);

         ^
In file included from /usr/include/stdio.h:937:0,
                 from repetare.c:1:
/usr/include/i386-linux-gnu/bits/stdio2.h:95:1: note: expected 'struct FILE * restrict' but argument is of type 'char *'
 fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...)
 ^
repetare.c:37:9: warning: passing argument 2 of 'fprintf' makes pointer from integer without a cast [enabled by default]
         fprintf("%d", c+1);

         ^
In file included from /usr/include/stdio.h:937:0,
                 from repetare.c:1:
/usr/include/i386-linux-gnu/bits/stdio2.h:95:1: note: expected 'const char * restrict' but argument is of type 'int'
 fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...)
 ^
repetare.c:37:9: warning: format not a string literal and no format arguments [-Wformat-security]
         fprintf("%d", c+1);

         ^
repetare.c:40:9: warning: passing argument 1 of 'fprintf' from incompatible pointer type [enabled by default]
         fprintf("IMPOSIBIL");

         ^
In file included from /usr/include/stdio.h:937:0,
                 from repetare.c:1:
/usr/include/i386-linux-gnu/bits/stdio2.h:95:1: note: expected 'struct FILE * restrict' but argument is of type 'char *'
 fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...)
 ^
repetare.c:40:9: error: too few arguments to function 'fprintf'
         fprintf("IMPOSIBIL");

         ^
repetare.c:7:11: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
     fscanf("%d", &n);

           ^
repetare.c:9:15: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
         fscanf("%d", &a[1]);

               ^
repetare.c:10:11: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
     fscanf("%d", &m);

           ^
repetare.c:12:15: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result]
         fscanf("%d", &b[1]);

               ^

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