#2411
secvp
Se consideră un şir cu N
numere naturale a[1]
, a[2]
, …, a[N]
. Asupra unui element a[i]
din şir se pot efectua operaţii de incrementare (adunare cu 1
: a[i] = a[i] + 1
) sau decrementare (scădere cu 1
: a[i] = a[i] - 1
). Fiecare element din şir poate fi incrementat sau decrementat de oricâte ori. Dat fiind șirul celor N
numere naturale, să se determine:
a. numărul total minim de operaţii necesare pentru a transforma toate numerele din şir în numere prime;
b. numărul minim de operații (incrementări şi decrementări) ce trebuie să fie efectuate asupra elementelor şirului astfel încât să existe o secvență de lungime K
formată numai din numere prime.
ONI Gimnaziu 2013
Problema | secvp | Operații I/O |
secvp.in /secvp.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 4 MB
/
Stivă 2 MB
|
Id soluție | #50462534 | Utilizator | |
Fișier | secvp.cpp | Dimensiune | 2.90 KB |
Data încărcării | 10 Aprilie 2024, 13:52 | Scor / rezultat | Eroare de compilare |
secvp.cpp:66:2: error: stray '#' in program }#include <fstream> ^ secvp.cpp:66:3: error: 'include' does not name a type }#include <fstream> ^ secvp.cpp:70:13: error: redefinition of 'std::ifstream cin' ifstream cin("secvp.in"); ^ secvp.cpp:5:10: error: 'std::ifstream cin' previously declared here ifstream cin("secvp.in"); ^ secvp.cpp:71:14: error: redefinition of 'std::ofstream cout' ofstream cout("secvp.out"); ^ secvp.cpp:6:10: error: 'std::ofstream cout' previously declared here ofstream cout("secvp.out"); ^ secvp.cpp:73:11: error: redefinition of 'const int DIM' const int DIM = 1000005; ^ secvp.cpp:8:11: error: 'const int DIM' previously defined here const int DIM = 1000005; ^ secvp.cpp:74:5: error: redefinition of 'int i' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:5: error: 'int i' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:8: error: redefinition of 'int n' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:8: error: 'int n' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:11: error: redefinition of 'int x' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:11: error: 'int x' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:14: error: redefinition of 'int j' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:14: error: 'int j' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:17: error: redefinition of 'int c' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:17: error: 'int c' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:20: error: redefinition of 'int y' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:20: error: 'int y' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:34: error: redefinition of 'int prim [100001]' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:23: error: 'int prim [100001]' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:45: error: redefinition of 'int v [100001]' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:37: error: 'int v [100001]' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:48: error: redefinition of 'int ind' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:48: error: 'int ind' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:53: error: redefinition of 'int s' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:53: error: 'int s' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:56: error: redefinition of 'int q' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:56: error: 'int q' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:59: error: redefinition of 'int mn' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:59: error: 'int mn' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:63: error: redefinition of 'int k' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:63: error: 'int k' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:76: error: redefinition of 'int loc [100005]' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:66: error: 'int loc [100005]' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:89: error: redefinition of 'int pre [100005]' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:79: error: 'int pre [100005]' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:74:92: error: redefinition of 'int nr' int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:9:92: error: 'int nr' previously declared here int i, n, x, j, c, y, prim[100001], v[100001], ind, s, q, mn, k, loc[100005], pre[100005], nr; ^ secvp.cpp:75:14: error: redefinition of 'char ciur [1000005]' char ciur[DIM]; ^ secvp.cpp:10:6: error: 'char ciur [1000005]' previously declared here char ciur[DIM]; ^ secvp.cpp: In function 'int CelMaiAproapePRIM(int)': secvp.cpp:77:5: error: redefinition of 'int CelMaiAproapePRIM(int)' int CelMaiAproapePRIM(int N) ^ secvp.cpp:12:5: error: 'int CelMaiAproapePRIM(int)' previously defined here int CelMaiAproapePRIM(int N) ^ secvp.cpp: In function 'int main()': secvp.cpp:94:5: error: redefinition of 'int main()' int main() { ^ secvp.cpp:29:5: error: 'int main()' previously defined here int main() { ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema secvp 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ă.