|
|
вернуться в форумPlease help, WA on #5 I don't know where I made mistake,it falls on 5th example!!! # include <iostream> using namespace std; int n,k,m,sol; int main () { cin>>n>>k; m=n/2; if (k==m) sol=0; if (k<m) sol=m-k; if (k>m) sol=k-m-1; cout<<sol<<endl; system("pause"); } Re: Please help, WA on #5 Mine too. Re: Please help, WA on #5 where is my mistake? falls on 5th var i,nr,n,k,c:integer; begin read(n,k); nr:=trunc(n/2); if (k>nr) then begin for i:=nr+1 to k-1 do inc(c); end; if (k<nr) then begin for i:=k+1 to nr do inc(c); end; write(c); end. |
|
|