Detalii evaluare #54381804

Rezumat problemă

Gigel are S lei. O ciocolata costă c lei, iar o napolitană costă n lei. Gigel poate să cumpere fie ciocolate, fie napolitane, cu condiția să cheltuiască întreaga sumă. Scrieți un program care să citească numerele S c n și să afișeze pe ecran:

  • textul CN dacă Gigel poate alege să cumpere ciocolate sau napolitane;
  • textul C dacă Gigel poate să cumpere numai ciocolate;
  • textul N dacă Gigel poate să cumpere numai napolitane;
  • textul nimic dacă Gigel nu poate să cumpere nici ciocolate, nici napolitane.

Detalii

Problema Cumparaturi1 Operații I/O tastatură/ecran
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #54381804 Utilizator Ionut Purcel (IonutPurcel05)
Fișier cumparaturi1.c Dimensiune 304 B
Data încărcării 27 Noiembrie 2024, 09:44 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

cumparaturi1.c:1:9: error: stray '#' in program
 int main#include <stdio.h>

         ^
cumparaturi1.c:1:10: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'include'
 int main#include <stdio.h>

          ^
In file included from cumparaturi1.c:2:0:
/usr/include/stdlib.h:139:1: error: unknown type name 'size_t'
 extern size_t __ctype_get_mb_cur_max (void) __THROW __wur;
 ^
/usr/include/stdlib.h:466:22: error: unknown type name 'size_t'
 extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
                      ^
/usr/include/stdlib.h:468:22: error: unknown type name 'size_t'
 extern void *calloc (size_t __nmemb, size_t __size)
                      ^
/usr/include/stdlib.h:468:38: error: unknown type name 'size_t'
 extern void *calloc (size_t __nmemb, size_t __size)
                                      ^
/usr/include/stdlib.h:480:36: error: unknown type name 'size_t'
 extern void *realloc (void *__ptr, size_t __size)
                                    ^
/usr/include/stdlib.h:756:9: error: unknown type name 'size_t'
         size_t __nmemb, size_t __size, __compar_fn_t __compar)
         ^
/usr/include/stdlib.h:756:25: error: unknown type name 'size_t'
         size_t __nmemb, size_t __size, __compar_fn_t __compar)
                         ^
In file included from /usr/include/stdlib.h:760:0,
                 from cumparaturi1.c:2:
/usr/include/i386-linux-gnu/bits/stdlib-bsearch.h:20:49: error: unknown type name 'size_t'
 bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size,
                                                 ^
/usr/include/i386-linux-gnu/bits/stdlib-bsearch.h:20:65: error: unknown type name 'size_t'
 bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size,
                                                                 ^
In file included from cumparaturi1.c:2:0:
/usr/include/stdlib.h:765:34: error: unknown type name 'size_t'
 extern void qsort (void *__base, size_t __nmemb, size_t __size,
                                  ^
/usr/include/stdlib.h:765:50: error: unknown type name 'size_t'
 extern void qsort (void *__base, size_t __nmemb, size_t __size,
                                                  ^
/usr/include/stdlib.h:863:36: error: unknown type name 'size_t'
 extern int mblen (const char *__s, size_t __n) __THROW;
                                    ^
/usr/include/stdlib.h:867:34: error: unknown type name 'size_t'
      const char *__restrict __s, size_t __n) __THROW;
                                  ^
/usr/include/stdlib.h:874:1: error: unknown type name 'size_t'
 extern size_t mbstowcs (wchar_t *__restrict  __pwcs,
 ^
/usr/include/stdlib.h:875:32: error: unknown type name 'size_t'
    const char *__restrict __s, size_t __n) __THROW;
                                ^
/usr/include/stdlib.h:877:1: error: unknown type name 'size_t'
 extern size_t wcstombs (char *__restrict __s,
 ^
/usr/include/stdlib.h:878:38: error: unknown type name 'size_t'
    const wchar_t *__restrict __pwcs, size_t __n)
                                      ^
In file included from /usr/include/stdlib.h:959:0,
                 from cumparaturi1.c:2:
/usr/include/i386-linux-gnu/bits/stdlib.h:25:9: error: unknown type name 'size_t'
         size_t __resolvedlen) __THROW __wur;
         ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdlib.h:24,
                 from cumparaturi1.c:2:
/usr/include/i386-linux-gnu/bits/stdlib.h:29:14: error: unknown type name 'size_t'
 extern char *__REDIRECT_NTH (__realpath_chk_warn,
              ^
In file included from /usr/include/stdlib.h:959:0,
                 from cumparaturi1.c:2:
/usr/include/i386-linux-gnu/bits/stdlib.h: In function 'realpath':
/usr/include/i386-linux-gnu/bits/stdlib.h:39:30: error: 'size_t' undeclared (first use in this function)
   if (__bos (__resolved) != (size_t) -1)
                              ^
/usr/include/i386-linux-gnu/bits/stdlib.h:39:30: note: each undeclared identifier is reported only once for each function it appears in
/usr/include/i386-linux-gnu/bits/stdlib.h: At top level:
/usr/include/i386-linux-gnu/bits/stdlib.h:52:52: error: unknown type name 'size_t'
 extern int __ptsname_r_chk (int __fd, char *__buf, size_t __buflen,
                                                    ^
/usr/include/i386-linux-gnu/bits/stdlib.h:53:8: error: unknown type name 'size_t'
        size_t __nreal) __THROW __nonnull ((2));
        ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdlib.h:24,
                 from cumparaturi1.c:2:
/usr/include/i386-linux-gnu/bits/stdlib.h:54:12: error: unknown type name 'size_t'
 extern int __REDIRECT_NTH (__ptsname_r_alias, (int __fd, char *__buf,
            ^
/usr/include/i386-linux-gnu/bits/stdlib.h:57:12: error: unknown type name 'size_t'
 extern int __REDIRECT_NTH (__ptsname_r_chk_warn,
            ^
/usr/include/i386-linux-gnu/bits/stdlib.h:57:12: error: unknown type name 'size_t'
 extern int __REDIRECT_NTH (__ptsname_r_chk_warn,
            ^
/usr/include/i386-linux-gnu/bits/stdlib.h:64:1: error: unknown type name 'size_t'
 __NTH (ptsname_r (int __fd, char *__buf, size_t __buflen))
 ^
In file included from /usr/include/stdlib.h:959:0,
                 from cumparaturi1.c:2:
/usr/include/i386-linux-gnu/bits/stdlib.h:77:54: error: unknown type name 'size_t'
 extern int __wctomb_chk (char *__s, wchar_t __wchar, size_t __buflen)
                                                      ^
/usr/include/i386-linux-gnu/bits/stdlib.h: In function 'wctomb':
/usr/include/i386-linux-gnu/bits/stdlib.h:92:23: error: 'size_t' undeclared (first use in this function)
   if (__bos (__s) != (size_t) -1 && __STDLIB_MB_LEN_MAX > __bos (__s))
                       ^
/usr/include/i386-linux-gnu/bits/stdlib.h: At top level:
/usr/include/i386-linux-gnu/bits/stdlib.h:98:1: error: unknown type name 'size_t'
 extern size_t __mbstowcs_chk (wchar_t *__restrict __dst,
 ^
/usr/include/i386-linux-gnu/bits/stdlib.h:100:10: error: unknown type name 'size_t'
          size_t __len, size_t __dstlen) __THROW;
          ^
/usr/include/i386-linux-gnu/bits/stdlib.h:100:24: error: unknown type name 'size_t'
          size_t __len, size_t __dstlen) __THROW;
                        ^
/usr/include/i386-linux-gnu/bits/stdlib.h:101:1: error: unknown type name 'size_t'
 extern size_t __REDIRECT_NTH (__mbstowcs_alias,
 ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdlib.h:24,
                 from cumparaturi1.c:2:
/usr/include/i386-linux-gnu/bits/stdlib.h:101:15: error: unknown type name 'size_t'
 extern size_t __REDIRECT_NTH (__mbstowcs_alias,
               ^
In file included from /usr/include/stdlib.h:959:0,
                 from cumparaturi1.c:2:
/usr/include/i386-linux-gnu/bits/stdlib.h:105:1: error: unknown type name 'size_t'
 extern size_t __REDIRECT_NTH (__mbstowcs_chk_warn,
 ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdlib.h:24,
                 from cumparaturi1.c:2:
/usr/include/i386-linux-gnu/bits/stdlib.h:105:15: error: unknown type name 'size_t'
 extern size_t __REDIRECT_NTH (__mbstowcs_chk_warn,
               ^
/usr/include/i386-linux-gnu/bits/stdlib.h:105:15: error: unknown type name 'size_t'
 extern size_t __REDIRECT_NTH (__mbstowcs_chk_warn,
               ^
/usr/include/i386-linux-gnu/bits/stdlib.h:113:1: error: expected ',' or ';' before 'mbstowcs'
 __NTH (mbstowcs (wchar_t *__restrict __dst, const char *__restrict __src,
 ^
In file included from /usr/include/stdlib.h:959:0,
                 from cumparaturi1.c:2:
/usr/include/i386-linux-gnu/bits/stdlib.h:130:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__wcstombs_chk'
 extern size_t __wcstombs_chk (char *__restrict __dst,
               ^
In file included from /usr/include/features.h:374:0,
                 from /usr/include/stdlib.h:24,
                 from cumparaturi1.c:2:
/usr/include/i386-linux-gnu/bits/stdlib.h:133:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__wcstombs_alias'
 extern size_t __REDIRECT_NTH (__wcstombs_alias,
               ^
/usr/include/i386-linux-gnu/bits/stdlib.h:137:15: error: expected '=', ',', ';', 'asm' or '__attribute__' before '__wcstombs_chk_warn'
 extern size_t __REDIRECT_NTH (__wcstombs_chk_warn,
               ^
/usr/include/i386-linux-gnu/bits/stdlib.h:144:1: error: expected ',' or ';' before 'wcstombs'
 __NTH (wcstombs (char *__restrict __dst, const wchar_t *__restrict __src,
 ^
cumparaturi1.c: In function 'main':
cumparaturi1.c:7:5: warning: implicit declaration of function 'scanf' [-Wimplicit-function-declaration]
     scanf("%d%d%d", s, c, n);

     ^
cumparaturi1.c:7:5: warning: incompatible implicit declaration of built-in function 'scanf' [enabled by default]
cumparaturi1.c:7:5: warning: format '%d' expects argument of type 'int *', but argument 2 has type 'int' [-Wformat=]
cumparaturi1.c:7:5: warning: format '%d' expects argument of type 'int *', but argument 3 has type 'int' [-Wformat=]
cumparaturi1.c:7:5: warning: format '%d' expects argument of type 'int *', but argument 4 has type 'int' [-Wformat=]
cumparaturi1.c:9:9: warning: implicit declaration of function 'printf' [-Wimplicit-function-declaration]
         printf("n");

         ^
cumparaturi1.c:9:9: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
cumparaturi1.c:13:5: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
     printf("c");}

     ^
cumparaturi1.c:16:13: warning: incompatible implicit declaration of built-in function 'printf' [enabled by default]
             printf("n");}

             ^

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