五月天青色头像情侣网名,国产亚洲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的評論 (共 條)

分享到微博請遵守國家法律
汪清县| 昌邑市| 红桥区| 朔州市| 阿巴嘎旗| 什邡市| 荔浦县| 会泽县| 凯里市| 筠连县| 谷城县| 霞浦县| 枝江市| 安达市| 章丘市| 信阳市| 宣汉县| 栖霞市| 五莲县| 铜山县| 岱山县| 奉化市| 浦江县| 建德市| 汤原县| 土默特右旗| 金沙县| 舞钢市| 九江市| 东山县| 句容市| 杭锦旗| 紫金县| 高邑县| 芦溪县| 济宁市| 讷河市| 五家渠市| 永修县| 衢州市| 开鲁县|