#3433
Forta
Forța unui număr natural nenul X
este egală cu numărul de divizori pozitivi ai lui X
. De exemplu, numărul X = 10
are forţa 4
, deoarece 10
are 4
divizori, mulțimea divizorilor fiind D
10
= {1,2,5,10}
.
Scrieţi un program care, cunoscând un șir de n
numere naturale nenule, rezolvă următoarele cerințe:
1. determină cel mai mic număr din șir care are forța maximă;
2. determină lungimea maximă a unei secvențe formată din numere cu aceeași forţă ce poate fi obținută prin rearanjarea convenabilă a elementelor din șir.
OJI 2020, clasa a VI-a
Problema | Forta | Operații I/O |
forta.in /forta.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 16 MB
/
Stivă 8 MB
|
Id soluție | #53472956 | Utilizator | |
Fișier | forta.cpp | Dimensiune | 1.28 KB |
Data încărcării | 01 Noiembrie 2024, 17:20 | Scor / rezultat | Eroare de compilare |
forta.cpp: In function 'int main()': forta.cpp:8:10: error: 'C' was not declared in this scope fin>>C; ^ forta.cpp:9:10: error: 'n' was not declared in this scope fin>>n; ^ forta.cpp:10:9: error: 'k' was not declared in this scope for(k=2;k<=n;k++) ^ forta.cpp:11:9: error: 'ciur' was not declared in this scope ciur[k]=1; ^ forta.cpp:12:9: error: 'k' was not declared in this scope for(k=2;k<=n;k++) ^ forta.cpp:13:12: error: 'ciur' was not declared in this scope if(ciur[k]==1) ^ forta.cpp:15:17: error: 'j' was not declared in this scope for(j=2*k;j<=n;j+=k) ^ forta.cpp:21:13: error: 'i' was not declared in this scope for(i=1;i<=n;i++) ^ forta.cpp:23:18: error: 'v' was not declared in this scope fin>>v[i]; ^ forta.cpp:25:17: error: 'k' was not declared in this scope for(k=1;k<=n;k++) ^ forta.cpp:27:56: warning: narrowing conversion of '-1' from 'int' to 'long long unsigned int' inside { } [-Wnarrowing] unsigned long long factorip[100000]={-1},puteri[100000]={-1},nrdiv=1,maxim=-1,minim=9000000000000000000; ^ forta.cpp:27:76: warning: narrowing conversion of '-1' from 'int' to 'long long unsigned int' inside { } [-Wnarrowing] unsigned long long factorip[100000]={-1},puteri[100000]={-1},nrdiv=1,maxim=-1,minim=9000000000000000000; ^ forta.cpp:28:20: error: 'ciur' was not declared in this scope if(ciur[k]==0) ^ forta.cpp:38:21: error: 'i1' was not declared in this scope for(i1=1;i1<=n;i1++) ^ forta.cpp:27:36: warning: unused variable 'factorip' [-Wunused-variable] unsigned long long factorip[100000]={-1},puteri[100000]={-1},nrdiv=1,maxim=-1,minim=9000000000000000000; ^ forta.cpp:27:86: warning: unused variable 'maxim' [-Wunused-variable] unsigned long long factorip[100000]={-1},puteri[100000]={-1},nrdiv=1,maxim=-1,minim=9000000000000000000; ^ forta.cpp:27:95: warning: unused variable 'minim' [-Wunused-variable] unsigned long long factorip[100000]={-1},puteri[100000]={-1},nrdiv=1,maxim=-1,minim=9000000000000000000; ^ forta.cpp:42:22: error: 'minim' was not declared in this scope if((v[i]<minim&&nrdiv==maxim)||(nrdiv>maxim)) ^ forta.cpp:42:29: error: 'nrdiv' was not declared in this scope if((v[i]<minim&&nrdiv==maxim)||(nrdiv>maxim)) ^ forta.cpp:42:36: error: 'maxim' was not declared in this scope if((v[i]<minim&&nrdiv==maxim)||(nrdiv>maxim)) ^ forta.cpp:48:15: error: 'minim' was not declared in this scope fout<<minim<<endl; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Forta 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ă.