五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

CF 194A - Exams

2023-08-22 08:32 作者:您是打尖兒還是住店呢  | 我要投稿

One day the Codeforces round author sat exams. He had n exams and he needed to get an integer from 2 to 5 for each exam. He will have to re-sit each failed exam, i.e. the exam that gets mark 2.


The author would need to spend too much time and effort to make the sum of his marks strictly more than k. That could have spoilt the Codeforces round. On the other hand, if the sum of his marks is strictly less than k, the author's mum won't be pleased at all.


The Codeforces authors are very smart and they always get the mark they choose themselves. Also, the Codeforces authors just hate re-sitting exams.


Help the author and find the minimum number of exams he will have to re-sit if he passes the exams in the way that makes the sum of marks for all n exams equal exactly k.


Input

The single input line contains space-separated integers n and k (1?≤?n?≤?50, 1?≤?k?≤?250) — the number of exams and the required sum of marks.


It is guaranteed that there exists a way to pass n exams in the way that makes the sum of marks equal exactly k.


Output

Print the single number — the minimum number of exams that the author will get a 2 for, considering that the sum of marks for all exams must equal k.

-----------------------------

有一天,Codeforces 回合的作者參加了考試。 他有n次考試,每次考試他都需要得到一個2到5之間的整數(shù)。 他必須重新參加每一次失敗的考試,即獲得 2 分的考試。


作者需要花費(fèi)太多的時間和精力才能使他的分?jǐn)?shù)總和嚴(yán)格超過 k。 這可能會破壞 Codeforces 回合。 另一方面,如果他的分?jǐn)?shù)總和嚴(yán)格小于 k,作者的媽媽根本不會高興。


Codeforces 的作者非常聰明,他們總是能得到自己選擇的分?jǐn)?shù)。 此外,Codeforces 作者只是討厭重新參加考試。


幫助作者求出如果他通過了考試,那么他需要重考的最少考試次數(shù),使得所有 n 次考試的分?jǐn)?shù)總和恰好等于 k。


輸入

單個輸入行包含空格分隔的整數(shù) n 和 k (1?≤?n?≤?50, 1?≤?k?≤?250) — 考試數(shù)量和所需的分?jǐn)?shù)總和。


保證存在一種通過n次考試的方法,使得分?jǐn)?shù)之和恰好等于k。


輸出

打印單個數(shù)字 — 考慮到所有考試的分?jǐn)?shù)總和必須等于 k,作者將獲得 2 分的最少考試次數(shù)。

--------------------------

求2個數(shù)的商,如果商為2 ,那么再看余數(shù),考試為2分的場數(shù)應(yīng)該是總場數(shù)-余數(shù)。

如果商大于2,那么一定是0;

下面是代碼:


CF 194A - Exams的評論 (共 條)

分享到微博請遵守國家法律
农安县| 凤台县| 获嘉县| 临沧市| 红桥区| 涞水县| 雅安市| 永泰县| 吴江市| 怀柔区| 台江县| 封丘县| 静宁县| 阳春市| 太仓市| 吉首市| 化德县| 华宁县| 武山县| 玉环县| 酉阳| 崇仁县| 博客| 田林县| 肇源县| 修文县| 阿拉善右旗| 西城区| 荆门市| 于田县| 永吉县| 乡宁县| 固始县| 海晏县| 芮城县| 灵宝市| 昆明市| 新竹县| 阜新市| 栾城县| 黄浦区|