原创 Surprising Strings

The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D

原创 Stones

Because of the wrong status of the bicycle, Sempr begin to walk east to west every morning and walk back every evening.

原创 身體質量指數

身體質量指數( BMI ) 是用 一個人的體重(單位:kg) 除以身高 (單位:m)的 平方得出的 數值(單位:kg/m 2 ) ,是目前國際上常用的衡量人體胖瘦程度以及是否健康的一個標準。 BMI  =  體重 (kg

原创 Jury Marks

Polycarp watched TV-show where k jury members one by one rated a participant by adding him a certain number of points (

原创 Jin Ge Jin Qu hao

(If you smiled when you see the title, this problem is for you ^_^) For those who don’t know KTV, see: http://en.wikipe

原创 種植樹苗

如下圖所示,我們在門前一條筆直的道路上栽了 N 棵樹苗。      但是,最近我們發現,如果兩棵樹苗的距離小於一個常數 D ,這兩棵樹苗的發育都會受到阻礙。因此我們決定移除一些樹苗,從而使任意兩棵樹苗的距離都不小於 D ,並且我

原创 Can you find it? 二分

Give you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the

原创 整數轉換

我們可以通過對一個整數 A 進行加1操作或者乘2操作使其轉換爲另一個整數 B 。 給出兩個整數 X ,  Y ,計算至少需要多少步才能將 X 轉換爲 Y 。 . Input 輸入的第一行包含一個整數 T  (1 

原创 棋盤問題

在一個給定形狀的棋盤(形狀可能是不規則的)上面擺放棋子,棋子沒有區別。要求擺放時任意的兩個棋子不能放在棋盤中的同一行或者同一列,請編程求解對於給定形狀和大小的棋盤,擺放k個棋子的所有可行的擺放方案C。 I

原创 圓桌問題

圓桌上圍坐着2n個人。其中n個人是好人,另外n個人是壞人。如果從第一個人開始數數,數到第m個人,則立即處死該人;然後從被處死的人之後開始數數,再將數到的第m個人處死……依此方法不斷處死圍坐在圓桌上的人。試問預先應如何安排這些好人與壞人的座

原创 Pingpang Balls

在雙魚的乒乓球上一般都會標有三星,二星,或者一星的字樣,星級越高就表示球的質量越好。 星級的評定和球的重量,直徑,硬度等很多因素有關,不過在這裏,我們只考慮球的重量對星級評定產生的影響。 乒乓球有一個標準的重量S,如果球的重量和標準越

原创 Train Problem I

As the new term comes, the Ignatius Train Station is very busy nowadays. A lot of student want to get back to school by

原创 Red and Black

There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A ma

原创 安全密碼

網絡上各類交易活動越來越普及,爲了能夠安安心心地上網,經常需要設置一個安全的密碼。一般來說一個比較安全的密碼至少應該滿足下面兩個條件: (1)密碼長度大於等於8。 (2)密碼中的字符應該來自下面“字符類別”中四組中的至少三組。 這四個