无码av一区二区三区无码,在线观看老湿视频福利,日韩经典三级片,成 人色 网 站 欧美大片在线观看

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

CF1842A - Tenzing and Tsondu

2023-06-25 11:27 作者:您是打尖兒還是住店呢  | 我要投稿

Olympus City recently launched the production of personal starships. Now everyone on Mars can buy one and fly to other planets inexpensively.

Each starship has a number —some positive integer x. Let's define the luckiness of a number x as the difference between the largest and smallest digits of that number. For example, 142857 has 8

?as its largest digit and 1 as its smallest digit, so its luckiness is 8?1=7. And the number 111 has all digits equal to 1, so its luckiness is zero.

Hateehc is a famous Martian blogger who often flies to different corners of the solar system. To release interesting videos even faster, he decided to buy himself a starship. When he came to the store, he saw starships with numbers from l to r inclusively. While in the store, Hateehc wanted to find a starship with the luckiest number.

Since there are a lot of starships in the store, and Hateehc can't program, you have to help the blogger and write a program that answers his question.

-------------------------------------------------------------------中文:

奧林巴斯城最近啟動(dòng)了個(gè)人星艦的生產(chǎn)。 現(xiàn)在火星上的每個(gè)人都可以購(gòu)買(mǎi)一架并以便宜的價(jià)格飛往其他星球。

每艘星艦都有一個(gè)數(shù)字——某個(gè)正整數(shù) x。 讓我們將數(shù)字 x 的幸運(yùn)值定義為該數(shù)字的最大數(shù)字和最小數(shù)字之間的差。 例如,142857 有 8 個(gè)

? 最大的數(shù)字是 1,最小的數(shù)字是 1,所以它的幸運(yùn)是 8?1=7。 而數(shù)字111的所有數(shù)字都等于1,因此它的幸運(yùn)值為零。

Hateehc是一位著名的火星博主,經(jīng)常飛往太陽(yáng)系的不同角落。 為了更快地發(fā)布有趣的視頻,他決定給自己買(mǎi)一艘星際飛船。 來(lái)到店里,他看到了一艘艘編號(hào)從l到r(含)的星艦。 在商店里,Hateehc 想要找到一艘擁有最幸運(yùn)數(shù)字的星艦。

由于商店里有很多星艦,而 Hateehc 不會(huì)編程,所以你必須幫助博主編寫(xiě)一個(gè)程序來(lái)回答他的問(wèn)題。

--------------------------------------------------------題解

判斷是否是lucky 數(shù)字,依次去遍歷即可,但是最大只能是9,所以在r值的選擇就可以去math.min(l+100,r)因?yàn)橹灰钪抵灰^(guò)100的話,最大值就一定是9了;

下面是代碼:


CF1842A - Tenzing and Tsondu的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國(guó)家法律
白银市| 昆山市| 鲜城| 安新县| 瑞丽市| 西平县| 高安市| 唐山市| 西峡县| 敖汉旗| 济南市| 宁夏| 东海县| 松溪县| 平凉市| 临澧县| 睢宁县| 富川| 韶山市| 拉萨市| 巴楚县| 山西省| 满洲里市| 勐海县| 盐池县| 临泉县| 安吉县| 永城市| 穆棱市| 漳浦县| 兴隆县| 建阳市| 钦州市| 庐江县| 嵊泗县| 田阳县| 陆河县| 咸丰县| 佳木斯市| 瑞丽市| 保靖县|