|
|
My code: const nmax=111111; var a:array[1..nmax] of int64; n,k,p:longint; i,cnt,cntmax,max:longint; sum:int64; BEGIN readln(n,k); read(p);
for i:=1 to n-k do a[i]:=1; sum:=n-k; cnt:=n-k; cntmax:=1; max:=2;
for i:=n-k+1 to n do begin if(100*cnt<p*(i-1)) then begin inc(max); inc(cnt,cntmax-1); cntmax:=1; end else inc(cntmax);
a[i]:=max; inc(sum,max); end;
writeln(sum); for i:=1 to n do write(a[i],' '); END.
31 1 2 2 3 3 3 3 3 3 4 4 28 1 2 2 2 3 3 3 3 3 3 3 26 1 1 1 1 1 1 2 3 4 5 6 Edited by author 16.08.2016 04:04 11 5 50 16 1 1 1 1 1 1 2 2 2 2 2 11 5 75 18 1 1 1 1 1 1 2 2 2 3 3 It is says, at least p percent from the total number of the bags that have already been checked If the total number includes current one? It does NOT include the current one. (and the statement should say "of the total number" and not "from the total number") deleted Edited by author 26.10.2013 14:34 What is Test #6. Edited by author 11.10.2014 10:31 i use the greedy,but wa on #5! the faq say "use %lld to output the long long" but it's should be %I64d.. F**K waste my two days. the server use windows instand of linux??? Edited by author 29.10.2013 13:14 |
|
|