Program esep; var input,output: text; n,i,j,g,nm,ans,t: integer; ara: array[0..1000] of integer; ar,arq: array[0..1000] of integer; ts,sum,a: integer; begin assign(input,'f.in'); reset(input); assign(output,'f.out'); rewrite(output); readln(input,a,n); ans: =10000; for i: =1 to n do begin read (input,ar[i]); ts: =ts+2*ar[i]; end; if ts< a then writeln(output,'no') else begin ara[1]: =3; for i: =2 to 15 do begin ara[i]: =3*ara[i-1]; end; for i: =1 to ara[n] do begin if arq[n]< 2 then begin inc(arq[n]); sum: =sum+ar[n]; inc(nm); end else begin g: =n; while arq[g]> 1 do begin sum: =sum-ar[g]*arq[g]; dec(nm,arq[g]); arq[g]: =0; dec(g); end; inc(arq[g]); sum: =sum+ar[g]; inc(nm); end; if sum=a then begin if nm< ans then ans: =nm; end; end; if ans> 1000 then writeln(output,'yes') else writeln(output, ans); end; close(output); close(input); end.
Mexx9050
23.01.2020
{вот правильное решение я там забыл то чтобы подсчитывать число букв a} var s: string; i, id, len, max, count,q: byte; begin q: =0; readln(s); len : = length(s); max : = 0; id : = 0; count : = 0; for i: =1 to len do if s[i] < > ' ' then count : = count + 1 else begin if count > max then begin max : = count; id : = i - count; end; count : = 0 end; if count > max then begin max : = count; id : = i - count; end; for i: =id to id+max do if s[i] = 'a' then begin q: =q+1; s[i] : = 'b'; writeln(s,' ' , q); end; end.
Ответить на вопрос
Поделитесь своими знаниями, ответьте на вопрос:
Что используется в качестве источника проецируемого изображения? ответ: электронно- модулятор ядро принтер