#1673
Cmmdc1
Fie un șir de numere naturale nenule a[1]
, a[2]
, …, a[n]
și un număr natural k
. Să se determine un grup de k
numere din șir care au proprietatea că cel mai mare divizor comun al lor este maxim. Dacă există mai multe astfel de grupuri, se cere acel grup pentru care suma elementelor este maximă.
ONI 2016, clasa a IX-a
Problema | Cmmdc1 | Operații I/O |
cmmdc1.in /cmmdc1.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #52346347 | Utilizator | |
Fișier | cmmdc1.cpp | Dimensiune | 610 B |
Data încărcării | 27 Septembrie 2024, 02:10 | Scor / rezultat | Eroare de compilare |
cmmdc1.cpp:1:11: warning: character constant too long for its type [enabled by default] const fin='cmmdc1.in';fout='cmmdc1.out'; ^ cmmdc1.cpp:1:28: warning: character constant too long for its type [enabled by default] const fin='cmmdc1.in';fout='cmmdc1.out'; ^ cmmdc1.cpp:3:13: error: too many decimal points in number a:array[1..1000000]of longint; ^ cmmdc1.cpp:1:7: error: 'fin' does not name a type const fin='cmmdc1.in';fout='cmmdc1.out'; ^ cmmdc1.cpp:1:23: error: 'fout' does not name a type const fin='cmmdc1.in';fout='cmmdc1.out'; ^ cmmdc1.cpp:2:1: error: 'var' does not name a type var f:text; ^ cmmdc1.cpp:3:6: error: found ':' in nested-name-specifier, expected '::' a:array[1..1000000]of longint; ^ cmmdc1.cpp:3:5: error: 'a' does not name a type a:array[1..1000000]of longint; ^ cmmdc1.cpp:4:5: error: 'n' does not name a type n,k,i,j,max,nr:longint; ^ cmmdc1.cpp:5:1: error: 'begin' does not name a type begin ^ cmmdc1.cpp:6:22: error: expected constructor, destructor, or type conversion before '(' token assign(f,fin);reset(f); ^ cmmdc1.cpp:7:9: error: expected constructor, destructor, or type conversion before '(' token readln(f,n,k); ^ cmmdc1.cpp:8:3: error: expected unqualified-id before 'for' for i:=1 to n do ^ cmmdc1.cpp:11:8: error: expected constructor, destructor, or type conversion before '(' token inc(a[j]); ^ cmmdc1.cpp:12:5: error: expected unqualified-id before 'if' if max<j then max:=j; ^ cmmdc1.cpp:13:3: error: 'end' does not name a type end; ^ cmmdc1.cpp:14:8: error: expected constructor, destructor, or type conversion before '(' token close(f); ^ cmmdc1.cpp:15:3: error: expected unqualified-id before 'for' for i:=max downto 1 do ^ cmmdc1.cpp:18:5: error: 'j' does not name a type j:=max div i *i; ^ cmmdc1.cpp:19:5: error: expected unqualified-id before 'while' while j>=i do begin ^ cmmdc1.cpp:21:10: error: expected constructor, destructor, or type conversion before '(' token dec(j,i) ^ cmmdc1.cpp:23:5: error: expected unqualified-id before 'if' if nr>=k then break ^ cmmdc1.cpp:25:9: error: expected constructor, destructor, or type conversion before '(' token assign(f,fout);rewrite(f); ^ cmmdc1.cpp:25:25: error: expected constructor, destructor, or type conversion before '(' token assign(f,fout);rewrite(f); ^ cmmdc1.cpp:26:10: error: expected constructor, destructor, or type conversion before '(' token writeln(f,i); ^ cmmdc1.cpp:27:3: error: 'j' does not name a type j:=max div i *i; ^ cmmdc1.cpp:28:3: error: expected unqualified-id before 'while' while k>0 do begin ^ cmmdc1.cpp:30:12: error: expected constructor, destructor, or type conversion before '(' token write(f,j,' ');dec(k);dec(a[j]) ^ cmmdc1.cpp:30:25: error: expected constructor, destructor, or type conversion before '(' token write(f,j,' ');dec(k);dec(a[j]) ^ cmmdc1.cpp:30:32: error: expected constructor, destructor, or type conversion before '(' token write(f,j,' ');dec(k);dec(a[j]) ^ cmmdc1.cpp:32:8: error: expected constructor, destructor, or type conversion before '(' token close(f); ^ cmmdc1.cpp:34:1: error: 'end' does not name a type end. ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Cmmdc1 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ă.