luyencode / comments

Server lưu trữ bình luận trên Luyện Code
https://luyencode.net
6 stars 3 forks source link

https://oj.luyencode.net/problem/CASTING #918

Open utterances-bot opened 1 year ago

utterances-bot commented 1 year ago

Chọn vai - Luyện Code Online

https://oj.luyencode.net/problem/CASTING

nguyenlequa commented 1 year ago

code AC (pascal) :

uses crt; var a,b,c,n,k,i,t:Longint; function min(a,b,c:Longint):Longint; Begin if (a <= b) and (a <= c) then exit(a) else if (b <= a) And (b <= c) then exit(b) else exit(c); End; Begin clrscr; readln(k); Readln(n,a,b,c); if k = 2 then write(min(a,b,c)) Else if a = min(a,b,c) then if (a-(n-b)-(n-c)) > 0 then write(a - (n - b) - (n - c)) else write(0) else If b = min(a,b,c) then if (b-(n-a)-(n-c)) > 0 then write(b-(n-a)-(n-c)) else write(0) else if (c-(n-a)-(n-b)) > 0 then write(c - (n - b) - (n - a)) else write(0); readln; END.