#4871
Se dă un șir de n numere naturale. Pentru fiecare din numerele din șir trebuie să afișați următorul număr natural, strict mai mare, care este prim.
| Problema | NextPrime | Operații I/O |
nextprime.in/nextprime.out
|
|---|---|---|---|
| Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64422816 | Utilizator | |
| Fișier | nextprime.cpp | Dimensiune | 1.18 KB |
| Data încărcării | 06 Mai 2026, 10:16 | Scor/rezultat | Eroare de compilare |
nextprime.cpp: In function ‘int main()’: nextprime.cpp:15:2: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation] 15 | while(k<=mm/2) | ^~~~~ nextprime.cpp:20:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘while’ 20 | for(j=2*k;j+k<=mm;j=j+k) | ^~~ nextprime.cpp:47:15: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 47 | for(j=2;j*j<=k && s==0;j++) | ^~~ nextprime.cpp:50:20: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 50 | if(s==0) | ^~ nextprime.cpp:50:20: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] nextprime.cpp:52:24: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’ 52 | k=k+2; | ^ /usr/lib/gcc/x86_64-linux-gnu/13/libstdc++.a(vterminate.o): in function \`__gnu_cxx::__verbose_terminate_handler()': (.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x22): relocation truncated to fit: R_X86_64_PC32 against \`.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating' (.text._ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x2f): relocation truncated to fit: R_X86_64_PC32 against \`.bss._ZZN9__gnu_cxx27__verbose_terminate_handlerEvE11terminating' /usr/lib/gcc/x86_64-linux-gnu/13/libstdc++.a(ios.o): in function \`std::ios_base::xalloc()': (.text._ZNSt8ios_base6xallocEv+0x12): relocation truncated to fit: R_X86_64_PC32 against \`.bss._ZZNSt8ios_base6xallocEvE6_S_top' (.text._ZNSt8ios_base6xallocEv+0x1e): relocation truncated to fit: R_X86_64_PC32 against \`.bss._ZZNSt8ios_base6xallocEvE6_S_top' (.text._ZNSt8ios_base6xallocEv+0x31): relocation truncated to fit: R_X86_64_PC32 against \`.bss._ZZNSt8ios_base6xallocEvE6_S_top' /usr/lib/gcc/x86_64-linux-gnu/13/libstdc++.a(locale-inst.o): in function \`char* std::string::_S_construct<char const*>(char const*, char const*, std::allocator<char> const&, std::forward_iterator_tag) [clone .isra.0]': (.text._ZNSs12_S_constructIPKcEEPcT_S3_RKSaIcESt20forward_iterator_tag.isra.0+0x4b): failed to convert GOTPCREL relocation against '_ZNSs4_Rep20_S_empty_rep_storageE'; relink with --no-relax (.text._ZNSs12_S_constructIPKcEEPcT_S3_RKSaIcESt20forward_iterator_tag.isra.0+0x73): failed to convert GOTPCREL relocation against '_ZNSs4_Rep20_S_empty_rep_storageE'; relink with --no-relax /usr/bin/ld: final link failed collect2: error: ld returned 1 exit status
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema NextPrime 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ă.