#4868
Un număr se numește in echilibru dacă are număr par de cifre și suma cifrelor din prima jumătate de număr este egală cu suma cifrelor din a doua jumătate a numărului.
Dat un număr n să se verifice dacă este in echilibru sau nu, afișând suma cifrelor din prima jumătate a numărului sau mesajul NU altfel.
Concurs de selecție clasa a 9-a Centru de Excelență in Informatică 2025 - Vaslui
| Problema | Echilibru | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #62848969 | Utilizator | |
| Fișier | echilibru.cpp | Dimensiune | 522 B |
| Data încărcării | 04 Februarie 2026, 10:09 | Scor/rezultat | Eroare de compilare |
echilibru.cpp:1:1: error: stray '\`' in program \`\`\`c ^ echilibru.cpp:1:1: error: stray '\`' in program echilibru.cpp:1:1: error: stray '\`' in program echilibru.cpp:33:1: error: stray '\`' in program \`\`\` ^ echilibru.cpp:33:1: error: stray '\`' in program echilibru.cpp:33:1: error: stray '\`' in program echilibru.cpp:1:4: error: 'c' does not name a type \`\`\`c ^ In file included from echilibru.cpp:3:0: /usr/include/string.h:47:8: error: 'size_t' has not been declared size_t __n) __THROW __nonnull ((1, 2)); ^ /usr/include/string.h:50:56: error: 'size_t' has not been declared extern void *memmove (void *__dest, const void *__src, size_t __n) ^ /usr/include/string.h:59:18: error: 'size_t' has not been declared int __c, size_t __n) ^ /usr/include/string.h:66:42: error: 'size_t' has not been declared extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1)); ^ /usr/include/string.h:69:56: error: 'size_t' has not been declared extern int memcmp (const void *__s1, const void *__s2, size_t __n) ^ /usr/include/string.h:76:42: error: 'size_t' has not been declared extern void *memchr (void *__s, int __c, size_t __n) ^ /usr/include/string.h:78:54: error: 'size_t' has not been declared extern const void *memchr (const void *__s, int __c, size_t __n) ^ /usr/include/string.h:83:29: error: 'size_t' has not been declared memchr (void *__s, int __c, size_t __n) __THROW ^ /usr/include/string.h:89:35: error: 'size_t' has not been declared memchr (const void *__s, int __c, size_t __n) __THROW ^ /usr/include/string.h:116:49: error: 'size_t' has not been declared extern "C++" void *memrchr (void *__s, int __c, size_t __n) ^ /usr/include/string.h:118:61: error: 'size_t' has not been declared extern "C++" const void *memrchr (const void *__s, int __c, size_t __n) ^ /usr/include/string.h:133:39: error: 'size_t' has not been declared const char *__restrict __src, size_t __n) ^ /usr/include/string.h:141:9: error: 'size_t' has not been declared size_t __n) __THROW __nonnull ((1, 2)); ^ /usr/include/string.h:147:57: error: 'size_t' has not been declared extern int strncmp (const char *__s1, const char *__s2, size_t __n) ^ /usr/include/string.h:154:8: error: 'size_t' does not name a type extern size_t strxfrm (char *__restrict __dest, ^ In file included from echilibru.cpp:3:0: /usr/include/string.h:169:8: error: 'size_t' does not name a type extern size_t strxfrm_l (char *__dest, const char *__src, size_t __n, ^ /usr/include/string.h:184:45: error: 'size_t' has not been declared extern char *strndup (const char *__string, size_t __n) ^ /usr/include/string.h:285:8: error: 'size_t' does not name a type extern size_t strcspn (const char *__s, const char *__reject) ^ /usr/include/string.h:289:8: error: 'size_t' does not name a type extern size_t strspn (const char *__s, const char *__accept) ^ /usr/include/string.h:382:46: error: 'size_t' has not been declared extern void *memmem (const void *__haystack, size_t __haystacklen, ^ /usr/include/string.h:383:30: error: 'size_t' has not been declared const void *__needle, size_t __needlelen) ^ /usr/include/string.h:389:34: error: 'size_t' has not been declared const void *__restrict __src, size_t __n) ^ /usr/include/string.h:392:39: error: 'size_t' has not been declared const void *__restrict __src, size_t __n) ^ /usr/include/string.h:399:8: error: 'size_t' does not name a type extern size_t strlen (const char *__s) ^ /usr/include/string.h:406:8: error: 'size_t' does not name a type extern size_t strnlen (const char *__string, size_t __maxlen) ^ /usr/include/string.h:438:53: error: 'size_t' has not been declared extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) ^ /usr/include/string.h:451:33: error: 'size_t' has not been declared extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1)); ^ /usr/include/string.h:455:53: error: 'size_t' has not been declared extern void bcopy (const void *__src, void *__dest, size_t __n) ^ /usr/include/string.h:459:31: error: 'size_t' has not been declared extern void bzero (void *__s, size_t __n) __THROW __nonnull ((1)); ^ /usr/include/string.h:462:54: error: 'size_t' has not been declared extern int bcmp (const void *__s1, const void *__s2, size_t __n) ^ /usr/include/string.h:538:61: error: 'size_t' has not been declared extern int strncasecmp (const char *__s1, const char *__s2, size_t __n) ^ /usr/include/string.h:550:6: error: 'size_t' has not been declared size_t __n, __locale_t __loc) ^ /usr/include/string.h:575:34: error: 'size_t' has not been declared const char *__restrict __src, size_t __n) ^ /usr/include/string.h:578:39: error: 'size_t' has not been declared const char *__restrict __src, size_t __n) ^ /usr/include/string.h:591:34: error: 'size_t' has not been declared extern void *memfrob (void *__s, size_t __n) __THROW __nonnull ((1)); ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from echilibru.cpp:2: /usr/include/i386-linux-gnu/bits/string3.h:48:1: error: 'size_t' has not been declared __NTH (memcpy (void *__restrict __dest, const void *__restrict __src, ^ /usr/include/i386-linux-gnu/bits/string3.h:55:1: error: 'size_t' has not been declared __NTH (memmove (void *__dest, const void *__src, size_t __len)) ^ /usr/include/i386-linux-gnu/bits/string3.h:62:1: error: 'size_t' has not been declared __NTH (mempcpy (void *__restrict __dest, const void *__restrict __src, ^ /usr/include/i386-linux-gnu/bits/string3.h:76:1: error: 'size_t' has not been declared __NTH (memset (void *__dest, int __ch, size_t __len)) ^ /usr/include/i386-linux-gnu/bits/string3.h:89:1: error: 'size_t' has not been declared __NTH (bcopy (const void *__src, void *__dest, size_t __len)) ^ /usr/include/i386-linux-gnu/bits/string3.h:95:1: error: 'size_t' has not been declared __NTH (bzero (void *__dest, size_t __len)) ^ /usr/include/i386-linux-gnu/bits/string3.h:117:1: error: 'size_t' has not been declared __NTH (strncpy (char *__restrict __dest, const char *__restrict __src, ^ In file included from /usr/include/string.h:640:0, from echilibru.cpp:3: /usr/include/i386-linux-gnu/bits/string3.h:124:62: error: 'size_t' has not been declared extern char *__stpncpy_chk (char *__dest, const char *__src, size_t __n, ^ /usr/include/i386-linux-gnu/bits/string3.h:125:8: error: 'size_t' has not been declared size_t __destlen) __THROW; ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from echilibru.cpp:2: /usr/include/i386-linux-gnu/bits/string3.h:126:14: error: 'size_t' has not been declared extern char *__REDIRECT_NTH (__stpncpy_alias, (char *__dest, const char *__src, ^ /usr/include/i386-linux-gnu/bits/string3.h:130:1: error: 'size_t' has not been declared __NTH (stpncpy (char *__dest, const char *__src, size_t __n)) ^ In file included from /usr/include/string.h:640:0, from echilibru.cpp:3: /usr/include/i386-linux-gnu/bits/string3.h: In function 'char* stpncpy(char*, const char*, int)': /usr/include/i386-linux-gnu/bits/string3.h:132:26: error: 'size_t' was not declared in this scope if (__bos (__dest) != (size_t) -1 ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from echilibru.cpp:2: /usr/include/i386-linux-gnu/bits/string3.h: At global scope: /usr/include/i386-linux-gnu/bits/string3.h:147:1: error: 'size_t' has not been declared __NTH (strncat (char *__restrict __dest, const char *__restrict __src, ^ echilibru.cpp: In function 'int main()': echilibru.cpp:9:18: error: 'scanf' was not declared in this scope scanf("%s", n); ^ echilibru.cpp:10:19: error: 'strlen' was not declared in this scope len = strlen(n); ^ echilibru.cpp:13:20: error: 'printf' was not declared in this scope printf("NU"); ^ echilibru.cpp:26:27: error: 'printf' was not declared in this scope printf("%d", suma1); ^ echilibru.cpp:28:20: error: 'printf' was not declared in this scope printf("NU"); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Echilibru 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ă.