Detalii evaluare #50062456

Rezumat problemă

#1351 nano

În lumea lui Nano totul se construiește la nivel atomic. Știința a ajuns așa departe încât poate construi ”plăci” dreptunghiulare de atomi în care aceștia sunt aliniați perfect, pe un singur strat, formând un rastru. Nano dorește să comande la o firmă plăci pătrate de dimensiuni mari. Dimensiunile sunt atât de mari încât numărul de atomi dintr-o placă poate să fie scris cu până la 500 cifre. Firma i-a dat o listă cu bucățile de material de care dispune, pentru fiecare bucată fiind cunoscut numărul de atomi componenți, urmând ca Nano să aleagă doar acele bucăți din care se pot construi plăci pătrate.

Scrieți un program care citind numărul de atomi ai fiecărei bucăți de material din fișierul nano.in scrie în fișierul nano.out doar bucățile de material din care se pot face plăcile dorite de Nano.

Detalii

Problema nano Operații I/O nano.in/nano.out
Limita timp 0.5 secunde Limita memorie Total: 2 MB / Stivă 1 MB
Id soluție #50062456 Utilizator Marinescu Andrei (Andrei_02_2007)
Fișier nano.cpp Dimensiune 4.75 KB
Data încărcării 25 Martie 2024, 20:51 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

nano.cpp:8:16: error: too many decimal points in number
        c:array[0..nmax] of qword;

                ^
nano.cpp:214:12: warning: character constant too long for its type [enabled by default]
  assign(fi,'nano.in');reset(fi);

            ^
nano.cpp:215:12: warning: character constant too long for its type [enabled by default]
  assign(fo,'nano.out');rewrite(fo);

            ^
nano.cpp:222:33: warning: character constant too long for its type [enabled by default]
    if l<>length(s) then writeln('NU bate lungimea')

                                 ^
nano.cpp:1:1: error: expected unqualified-id before '{' token
 {$H}

 ^
nano.cpp:2:1: error: 'program' does not name a type
 program patrat;

 ^
nano.cpp:3:1: error: 'uses' does not name a type
 uses sysutils;

 ^
nano.cpp:4:9: error: found ':' in nested-name-specifier, expected '::'
 const dx:qword=1000000000;

         ^
nano.cpp:4:7: error: 'dx' does not name a type
 const dx:qword=1000000000;

       ^
nano.cpp:5:7: error: 'kdx' does not name a type
       kdx=9;// nr. de 0 din dx

       ^
nano.cpp:6:7: error: 'nmax' does not name a type
       nmax=1000;

       ^
nano.cpp:7:1: error: 'type' does not name a type
 type nr_mare=record

 ^
nano.cpp:9:9: error: found ':' in nested-name-specifier, expected '::'
        k:integer;

         ^
nano.cpp:9:8: error: 'k' does not name a type
        k:integer;

        ^
nano.cpp:10:6: error: 'end' does not name a type
      end;

      ^
nano.cpp:11:1: error: 'var' does not name a type
 var a,b,c,d,e:nr_mare;

 ^
nano.cpp:12:5: error: 'i' does not name a type
     i,n,l:integer;

     ^
nano.cpp:13:5: error: 'fi' does not name a type
     fi,fo:text;

     ^
nano.cpp:14:6: error: found ':' in nested-name-specifier, expected '::'
     s:ansistring;

      ^
nano.cpp:14:5: error: 's' does not name a type
     s:ansistring;

     ^
nano.cpp:16:1: error: 'procedure' does not name a type
 procedure pune_sir_in_nr(var x:nr_mare;s:ansistring);

 ^
nano.cpp:16:41: error: found ':' in nested-name-specifier, expected '::'
 procedure pune_sir_in_nr(var x:nr_mare;s:ansistring);

                                         ^
nano.cpp:16:40: error: 's' does not name a type
 procedure pune_sir_in_nr(var x:nr_mare;s:ansistring);

                                        ^
nano.cpp:17:1: error: 'var' does not name a type
 var i,k,c,l:longint;n:qword;

 ^
nano.cpp:17:22: error: found ':' in nested-name-specifier, expected '::'
 var i,k,c,l:longint;n:qword;

                      ^
nano.cpp:17:21: error: 'n' does not name a type
 var i,k,c,l:longint;n:qword;

                     ^
nano.cpp:18:1: error: 'begin' does not name a type
 begin

 ^
nano.cpp:20:2: error: 'i' does not name a type
  i:=0;{poz. la care pun cifrele}

  ^
nano.cpp:20:7: error: expected unqualified-id before '{' token
  i:=0;{poz. la care pun cifrele}

       ^
nano.cpp:21:2: error: 'l' does not name a type
  l:=length(s);

  ^
nano.cpp:22:2: error: expected unqualified-id before 'while'
  while l>=k do

  ^
nano.cpp:24:30: error: expected unqualified-id before '{' token
     val(copy(s,l-k+1,k),n,c);{extragem din sir ultimele caractere si le transf. in nr}

                              ^
nano.cpp:25:5: error: 'x' does not name a type
     x.c[i]:=n;

     ^
nano.cpp:26:5: error: expected unqualified-id before 'delete'
     delete(s,l-k+1,k);

     ^
nano.cpp:27:8: error: expected constructor, destructor, or type conversion before '(' token
     dec(l,k);

        ^
nano.cpp:28:8: error: expected constructor, destructor, or type conversion before '(' token
     inc(i);

        ^
nano.cpp:29:3: error: 'end' does not name a type
   end;

   ^
nano.cpp:30:2: error: expected unqualified-id before 'if'
  if l>0 then

  ^
nano.cpp:32:30: error: expected unqualified-id before '{' token
     val(copy(s,l-k+1,k),n,c);{extragem din sir ultimele caractere si le transf. in nr}

                              ^
nano.cpp:33:5: error: 'x' does not name a type
     x.c[i]:=n;

     ^
nano.cpp:34:5: error: 'x' does not name a type
     x.k:=i;

     ^
nano.cpp:35:3: error: 'end' does not name a type
   end

   ^
nano.cpp:37:1: error: 'end' does not name a type
 end;

 ^
nano.cpp:39:1: error: 'procedure' does not name a type
 procedure pune_nr_in_sir(var s:ansistring;x:nr_mare);

 ^
nano.cpp:39:44: error: found ':' in nested-name-specifier, expected '::'
 procedure pune_nr_in_sir(var s:ansistring;x:nr_mare);

                                            ^
nano.cpp:39:43: error: 'x' does not name a type
 procedure pune_nr_in_sir(var s:ansistring;x:nr_mare);

                                           ^
nano.cpp:40:1: error: 'var' does not name a type
 var i:longint;

 ^
nano.cpp:41:6: error: found ':' in nested-name-specifier, expected '::'
     t:ansistring;

      ^
nano.cpp:41:5: error: 't' does not name a type
     t:ansistring;

     ^
nano.cpp:42:1: error: 'begin' does not name a type
 begin

 ^
nano.cpp:44:2: error: 'i' does not name a type
  i:=x.k-1;

  ^
nano.cpp:45:2: error: expected unqualified-id before 'while'
  while i>=0 do

  ^
nano.cpp:48:4: error: expected unqualified-id before 'while'
    while length(t)<kdx do t:='0'+t; // cat timp nu are nr. necesar de cifre punem un 0 la inceput

    ^
nano.cpp:49:4: error: 's' does not name a type
    s:=s+t;// adaugam sirul la sirul ce va forma nr.

    ^
nano.cpp:50:4: error: 'i' does not name a type
    i:=i-1;

    ^
nano.cpp:51:3: error: 'end' does not name a type
   end;

   ^
nano.cpp:52:1: error: 'end' does not name a type
 end;

 ^
nano.cpp:55:1: error: 'procedure' does not name a type
 procedure add(var x,y,z:nr_mare); {adun pe y cu z si pun in x}

 ^
nano.cpp:55:35: error: expected unqualified-id before '{' token
 procedure add(var x,y,z:nr_mare); {adun pe y cu z si pun in x}

                                   ^
nano.cpp:56:1: error: 'var' does not name a type
 var i,km:longint;t:qword;

 ^
nano.cpp:56:19: error: found ':' in nested-name-specifier, expected '::'
 var i,km:longint;t:qword;

                   ^
nano.cpp:56:18: error: 't' does not name a type
 var i,km:longint;t:qword;

                  ^
nano.cpp:57:1: error: 'begin' does not name a type
 begin

 ^
nano.cpp:59:2: error: expected unqualified-id before 'if'
  if y.k>z.k then km:=y.k else km:=z.k; // determinam cel mai lung nr.

  ^
nano.cpp:60:2: error: 'x' does not name a type
  x.k:=km;

  ^
nano.cpp:61:2: error: expected unqualified-id before 'for'
  for i:= 0 to km do

  ^
nano.cpp:64:5: error: 't' does not name a type
     t:=x.c[i] div dx;

     ^
nano.cpp:65:5: error: 'x' does not name a type
     x.c[i]:=x.c[i] mod dx;

     ^
nano.cpp:66:3: error: 'end' does not name a type
   end;

   ^
nano.cpp:67:2: error: expected unqualified-id before 'if'
  if t>0 then // inseamna ce nr. de cifre a crescut prin adunare

  ^
nano.cpp:70:4: error: 'x' does not name a type
    x.c[x.k]:=t;

    ^
nano.cpp:71:3: error: 'end' does not name a type
   end;

   ^
nano.cpp:72:1: error: 'end' does not name a type
 end;

 ^
nano.cpp:74:1: error: 'procedure' does not name a type
 procedure inmul(var x,y,z:nr_mare);

 ^
nano.cpp:75:1: error: 'var' does not name a type
 var i,j,k:longint;t:qword;

 ^
nano.cpp:75:20: error: found ':' in nested-name-specifier, expected '::'
 var i,j,k:longint;t:qword;

                    ^
nano.cpp:75:19: error: 't' does not name a type
 var i,j,k:longint;t:qword;

                   ^
nano.cpp:76:1: error: 'begin' does not name a type
 begin

 ^
nano.cpp:78:2: error: 'x' does not name a type
  x.k:=y.k+z.k;

  ^
nano.cpp:80:2: error: expected unqualified-id before 'for'
  for i:=0 to y.k do

  ^
nano.cpp:84:2: error: 't' does not name a type
  t:=0;

  ^
nano.cpp:85:2: error: expected unqualified-id before 'for'
  for i:=0 to x.k do

  ^
nano.cpp:88:4: error: 't' does not name a type
    t:=x.c[i] div dx;

    ^
nano.cpp:89:4: error: 'x' does not name a type
    x.c[i]:=x.c[i] mod dx;

    ^
nano.cpp:90:3: error: 'end' does not name a type
   end;

   ^
nano.cpp:91:2: error: expected unqualified-id before 'if'
  if t>0 then begin inc(x.k);x.c[x.k]:=t;end;

  ^
nano.cpp:91:29: error: 'x' does not name a type
  if t>0 then begin inc(x.k);x.c[x.k]:=t;end;

                             ^
nano.cpp:91:41: error: 'end' does not name a type
  if t>0 then begin inc(x.k);x.c[x.k]:=t;end;

                                         ^
nano.cpp:92:1: error: 'end' does not name a type
 end;

 ^
nano.cpp:94:1: error: expected unqualified-id before '{' token
 {compara 2 numere mari si return 1 daca primul e mai mare, 0 daca-s egale, -1 daca al doilea e mai mare}

 ^
nano.cpp:95:1: error: 'function' does not name a type
 function comp(var x,y:nr_mare):integer;

 ^
nano.cpp:96:1: error: 'var' does not name a type
 var r,i:integer;

 ^
nano.cpp:97:1: error: 'begin' does not name a type
 begin

 ^
nano.cpp:103:7: error: expected unqualified-id before 'while'
       while (i>=0)and(x.c[i]=y.c[i]) do dec(i);

       ^
nano.cpp:104:7: error: expected unqualified-id before 'if'
       if i < 0 then r:=0

       ^
nano.cpp:107:5: error: 'end' does not name a type
     end;

     ^
nano.cpp:108:2: error: 'comp' does not name a type
  comp:=r;

  ^
nano.cpp:109:1: error: 'end' does not name a type
 end;

 ^
nano.cpp:112:1: error: 'function' does not name a type
 function gen10(n:integer):ansistring;

 ^
nano.cpp:113:1: error: 'var' does not name a type
 var s:ansistring;

 ^
nano.cpp:114:1: error: 'begin' does not name a type
 begin

 ^
nano.cpp:116:2: error: expected unqualified-id before 'while'
  while(n>1)do begin s:=s+'0';dec(n);end;

  ^
nano.cpp:116:33: error: expected constructor, destructor, or type conversion before '(' token
  while(n>1)do begin s:=s+'0';dec(n);end;

                                 ^
nano.cpp:116:37: error: 'end' does not name a type
  while(n>1)do begin s:=s+'0';dec(n);end;

                                     ^
nano.cpp:117:2: error: 'gen10' does not name a type
  gen10:=s;

  ^
nano.cpp:118:1: error: 'end' does not name a type
 end;

 ^
nano.cpp:120:1: error: 'function' does not name a type
 function gen99(n:integer):ansistring;

 ^
nano.cpp:121:1: error: 'var' does not name a type
 var s:ansistring;

 ^
nano.cpp:122:1: error: 'begin' does not name a type
 begin

 ^
nano.cpp:124:2: error: expected unqualified-id before 'while'
  while(n>1)do begin s:=s+'9';dec(n);end;

  ^
nano.cpp:124:33: error: expected constructor, destructor, or type conversion before '(' token
  while(n>1)do begin s:=s+'9';dec(n);end;

                                 ^
nano.cpp:124:37: error: 'end' does not name a type
  while(n>1)do begin s:=s+'9';dec(n);end;

                                     ^
nano.cpp:125:2: error: 'gen99' does not name a type
  gen99:=s;

  ^
nano.cpp:126:1: error: 'end' does not name a type
 end;

 ^
nano.cpp:129:1: error: 'procedure' does not name a type
 procedure div2(var x:nr_mare);{imparte un numar mare la 2}

 ^
nano.cpp:129:31: error: expected unqualified-id before '{' token
 procedure div2(var x:nr_mare);{imparte un numar mare la 2}

                               ^
nano.cpp:130:1: error: 'var' does not name a type
 var t:longint;

 ^
nano.cpp:131:6: error: found ':' in nested-name-specifier, expected '::'
     i:integer;

      ^
nano.cpp:131:5: error: 'i' does not name a type
     i:integer;

     ^
nano.cpp:132:1: error: 'begin' does not name a type
 begin

 ^
nano.cpp:133:8: error: expected unqualified-id before '{' token
   t:=0;{transportul e 0 la inceput}

        ^
nano.cpp:134:3: error: expected unqualified-id before 'for'
   for i:=x.k downto 0 do

   ^
nano.cpp:137:5: error: 't' does not name a type
     t:=x.c[i] mod 2;

     ^
nano.cpp:138:5: error: 'x' does not name a type
     x.c[i]:=x.c[i] div 2;

     ^
nano.cpp:139:4: error: 'end' does not name a type
    end;

    ^
nano.cpp:140:3: error: expected unqualified-id before 'while'
   while(x.c[x.k]=0)do dec(x.k);

   ^
nano.cpp:141:1: error: 'end' does not name a type
 end;

 ^
nano.cpp:143:1: error: 'procedure' does not name a type
 procedure dec_mare( var x:nr_mare);

 ^
nano.cpp:144:1: error: 'var' does not name a type
 var i:longint;

 ^
nano.cpp:145:1: error: 'begin' does not name a type
 begin

 ^
nano.cpp:146:14: error: 'i' does not name a type
  dec(x.c[0]);i:=0;

              ^
nano.cpp:147:2: error: expected unqualified-id before 'while'
  while(x.c[i]<0)do begin

  ^
nano.cpp:148:20: error: expected constructor, destructor, or type conversion before '(' token
   dec(x.c[i+1]);inc(x.c[i],dx);i:=i+1;

                    ^
nano.cpp:148:32: error: 'i' does not name a type
   dec(x.c[i+1]);inc(x.c[i],dx);i:=i+1;

                                ^
nano.cpp:149:2: error: 'end' does not name a type
  end;

  ^
nano.cpp:150:3: error: expected unqualified-id before 'while'
   while(x.c[x.k]=0)do dec(x.k);

   ^
nano.cpp:151:1: error: 'end' does not name a type
 end;

 ^
nano.cpp:153:1: error: 'procedure' does not name a type
 procedure inc_mare(var x:nr_mare);

 ^
nano.cpp:154:1: error: 'var' does not name a type
 var i:longint;

 ^
nano.cpp:155:1: error: 'begin' does not name a type
 begin

 ^
nano.cpp:157:5: error: expected constructor, destructor, or type conversion before '(' token
  inc(x.c[0]);

     ^
nano.cpp:158:2: error: expected unqualified-id before 'while'
  while(x.c[i]=dx)do

  ^
nano.cpp:160:17: error: expected constructor, destructor, or type conversion before '(' token
    x.c[i]:=0;inc(x.c[i+1]);

                 ^
nano.cpp:161:7: error: expected constructor, destructor, or type conversion before '(' token
    inc(i);

       ^
nano.cpp:162:3: error: 'end' does not name a type
   end;

   ^
nano.cpp:163:3: error: expected unqualified-id before 'if'
   if i>x.k then inc(x.k);

   ^
nano.cpp:164:1: error: 'end' does not name a type
 end;

 ^
nano.cpp:167:1: error: 'function' does not name a type
 function e_patrat(s:ansistring):boolean;

 ^
nano.cpp:168:1: error: 'var' does not name a type
 var x:qword;er,l,i:integer;

 ^
nano.cpp:168:13: error: 'er' does not name a type
 var x:qword;er,l,i:integer;

             ^
nano.cpp:169:4: error: found ':' in nested-name-specifier, expected '::'
   g:ansistring;f:boolean;

    ^
nano.cpp:169:3: error: 'g' does not name a type
   g:ansistring;f:boolean;

   ^
nano.cpp:169:17: error: found ':' in nested-name-specifier, expected '::'
   g:ansistring;f:boolean;

                 ^
nano.cpp:169:16: error: 'f' does not name a type
   g:ansistring;f:boolean;

                ^
nano.cpp:170:1: error: 'begin' does not name a type
 begin

 ^
nano.cpp:172:4: error: 'begin' does not name a type
    begin

    ^
nano.cpp:174:5: error: 'e_patrat' does not name a type
     e_patrat:=frac(sqrt(x))=0;

     ^
nano.cpp:175:4: error: 'end' does not name a type
    end

    ^
nano.cpp:177:4: error: 'begin' does not name a type
    begin

    ^
nano.cpp:178:19: error: expected unqualified-id before '{' token
     l:=length(s); {determinam lungimea}

                   ^
nano.cpp:179:5: error: 'l' does not name a type
     l:=l+l mod 2; {il aducem la cel mai apropiat nr. par}

     ^
nano.cpp:179:19: error: expected unqualified-id before '{' token
     l:=l+l mod 2; {il aducem la cel mai apropiat nr. par}

                   ^
nano.cpp:180:5: error: 'l' does not name a type
     l:=l div 2;   {determinam lungimea posibilului radical}

     ^
nano.cpp:180:19: error: expected unqualified-id before '{' token
     l:=l div 2;   {determinam lungimea posibilului radical}

                   ^
nano.cpp:181:5: error: 'g' does not name a type
     g:=gen10(l);

     ^
nano.cpp:182:19: error: expected constructor, destructor, or type conversion before '(' token
     pune_sir_in_nr(a,g);

                   ^
nano.cpp:183:5: error: 'g' does not name a type
     g:=gen99(l);

     ^
nano.cpp:184:19: error: expected constructor, destructor, or type conversion before '(' token
     pune_sir_in_nr(b,g);

                   ^
nano.cpp:185:5: error: 'f' does not name a type
     f:=false;{inca nu l-am gasit}

     ^
nano.cpp:185:14: error: expected unqualified-id before '{' token
     f:=false;{inca nu l-am gasit}

              ^
nano.cpp:186:19: error: expected constructor, destructor, or type conversion before '(' token
     pune_sir_in_nr(e,s);{punem in e nr. de testat}

                   ^
nano.cpp:186:25: error: expected unqualified-id before '{' token
     pune_sir_in_nr(e,s);{punem in e nr. de testat}

                         ^
nano.cpp:188:5: error: 'repeat' does not name a type
     repeat

     ^
nano.cpp:190:10: error: expected constructor, destructor, or type conversion before '(' token
      div2(c); {calculam mijlocul}

          ^
nano.cpp:190:15: error: expected unqualified-id before '{' token
      div2(c); {calculam mijlocul}

               ^
nano.cpp:191:11: error: expected constructor, destructor, or type conversion before '(' token
      inmul(d,c,c);{ridic pe c la patrat}

           ^
nano.cpp:191:19: error: expected unqualified-id before '{' token
      inmul(d,c,c);{ridic pe c la patrat}

                   ^
nano.cpp:192:6: error: expected unqualified-id before 'case'
      case comp(d,e) of

      ^
nano.cpp:194:7: error: expected unqualified-id before numeric constant
       1:begin  {d e mai mare ca e, trebuie cautat in stanga}

       ^
nano.cpp:195:10: error: 'b' does not name a type
          b:=c;

          ^
nano.cpp:196:18: error: expected constructor, destructor, or type conversion before '(' token
          dec_mare(b);

                  ^
nano.cpp:197:9: error: 'end' does not name a type
         end;

         ^
nano.cpp:198:6: error: expected unqualified-id before '-' token
      -1:begin

      ^
nano.cpp:200:18: error: expected constructor, destructor, or type conversion before '(' token
          inc_mare(a);

                  ^
nano.cpp:201:9: error: 'end' does not name a type
         end;

         ^
nano.cpp:202:6: error: 'end' does not name a type
      end;

      ^
nano.cpp:203:5: error: 'until' does not name a type
     until f or (comp(a,b)>0); {pana cand gasim sau stanga e mai mare ca dreapta}

     ^
nano.cpp:203:31: error: expected unqualified-id before '{' token
     until f or (comp(a,b)>0); {pana cand gasim sau stanga e mai mare ca dreapta}

                               ^
nano.cpp:204:5: error: 'e_patrat' does not name a type
     e_patrat:=f;

     ^
nano.cpp:205:4: error: 'end' does not name a type
    end;

    ^
nano.cpp:206:1: error: 'end' does not name a type
 end;

 ^
nano.cpp:211:1: error: 'BEGIN' does not name a type
 BEGIN

 ^
nano.cpp:214:28: error: expected constructor, destructor, or type conversion before '(' token
  assign(fi,'nano.in');reset(fi);

                            ^
nano.cpp:215:8: error: expected constructor, destructor, or type conversion before '(' token
  assign(fo,'nano.out');rewrite(fo);

        ^
nano.cpp:215:31: error: expected constructor, destructor, or type conversion before '(' token
  assign(fo,'nano.out');rewrite(fo);

                               ^
nano.cpp:216:8: error: expected constructor, destructor, or type conversion before '(' token
  readln(fi,n);

        ^
nano.cpp:217:2: error: expected unqualified-id before 'for'
  for i:=1 to n do

  ^
nano.cpp:221:10: error: expected constructor, destructor, or type conversion before '(' token
    readln(fi,s);

          ^
nano.cpp:222:4: error: expected unqualified-id before 'if'
    if l<>length(s) then writeln('NU bate lungimea')

    ^
nano.cpp:225:3: error: 'end' does not name a type
   end;

   ^
nano.cpp:226:7: error: expected constructor, destructor, or type conversion before '(' token
  close(fi);

       ^
nano.cpp:227:7: error: expected constructor, destructor, or type conversion before '(' token
  close(fo);

       ^
nano.cpp:229:1: error: 'END' does not name a type
 END.
 ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema nano face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

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ă.