最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

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

CF 460A - Vasya and Socks

2023-07-25 16:31 作者:您是打尖兒還是住店呢  | 我要投稿

原文

Vasya has n pairs of socks. In the morning of each day Vasya has to put on a pair of socks before he goes to school. When he comes home in the evening, Vasya takes off the used socks and throws them away. Every m-th day (at days with numbers m,?2m,?3m,?...) mom buys a pair of socks to Vasya. She does it late in the evening, so that Vasya cannot put on a new pair of socks before the next day. How many consecutive days pass until Vasya runs out of socks? Input The single line contains two integers n and m (1?≤?n?≤?100; 2?≤?m?≤?100), separated by a space. Output Print a single integer — the answer to the problem.

翻譯結(jié)果

Vasya 有 n 雙襪子。 每天早上,瓦夏必須穿上一雙襪子才能去上學(xué)。 晚上回家后,瓦夏脫下用過(guò)的襪子并扔掉。 每個(gè)第m天(在數(shù)字為m、?2m、?3m、?...的日子)媽媽都會(huì)給Vasya買(mǎi)一雙襪子。 她在晚上很晚的時(shí)候做這件事,這樣瓦夏就無(wú)法在第二天之前穿上一雙新襪子。 連續(xù)多少天 Vasya 的襪子就會(huì)用完? 輸入 單行包含兩個(gè)整數(shù) n 和 m (1?≤?n?≤?100; 2?≤?m?≤?100),用空格分隔。 輸出 打印一個(gè)整數(shù)——問(wèn)題的答案。

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

循環(huán)遍歷即可,只是每當(dāng)是m的倍數(shù)的時(shí)候n++一下,

下面是代碼:



CF 460A - Vasya and Socks的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
海南省| 元谋县| 辽中县| 赫章县| 溆浦县| 兖州市| 财经| 马尔康县| 县级市| 水城县| 双柏县| 淮安市| 辽源市| 隆林| 双城市| 图们市| 蕲春县| 旺苍县| 衡山县| 凤山县| 绥芬河市| 绥棱县| 漾濞| 兴安县| 铜山县| 贵德县| 依兰县| 田东县| 丹东市| 沈丘县| 得荣县| 资源县| 江北区| 兴安县| 县级市| 灵川县| 安陆市| 三亚市| 临湘市| 莱阳市| 朔州市|