原创 Prime Distance(數論)

Description The branch of mathematics called number theory is about properties of numbers. One of the areas that h

原创 IMMEDIATE DECODABILITY(字典樹)

Description An encoding of a set of symbols is said to be immediately decodable if no code for one symbol is the p

原创 NUMBER BASE CONVERSION(高精度)

Description Write a program to convert numbers in one base to numbers in a second base. There are 62 different dig

原创 A/B(數論)

Description 要求(A/B)%9973,但由於A很大,我們只給出n(n=A%9973)(我們給定的A必能被B整除,且gcd(B,9973) = 1)。   Input 數據的第一行是一個T,表示有T組數據。 每

原创 Panda(線段樹 )

Description When I wrote down this letter, you may have been on the airplane to U.S.  We have known for 15 years

原创 The Balance(數論)

Description Ms. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dose of medicine. For

原创 敵兵佈陣(線段樹)

Description C國的死對頭A國這段時間正在進行軍事演習,所以C國間諜頭子Derek和他手下Tidy又開始忙乎了。A國在海岸線沿直線佈置了N個工兵營地,Derek和Tidy的任務就是要監視這些工兵營地的活動情況。由於採取了

原创 青蛙的約會(數論)

Description 兩隻青蛙在網上相識了,它們聊得很開心,於是覺得很有必要見一面。它們很高興地發現它們住在同一條緯度線上,於是它們約定各自朝西跳,直到碰面爲止。可是它們出發之前忘記了一件很重要的事情,既沒有問清楚對方的特徵,

原创 Wolf and Rabbit

Description There is a hill with n holes around. The holes are signed from 0 to n-1. A rabbit must hide in one of

原创 Heavy Cargo(數論)

Description Big Johnsson Trucks Inc. is a company specialized in manufacturing big trucks. Their latest model, the

原创 Goldbach's Conjecture(數論)

Description In 1742, Christian Goldbach, a German amateur mathematician, sent a letter to Leonhard Euler in which

原创 Phone List(字典樹,數據結構)

Description Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix

原创 Biorhythms(數論)

Description Some people believe that there are three cycles in a person's life that start the day he or she is bor

原创 A Simple Problem with Integers(線段樹)

Description You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of oper

原创 Kindergarten(二分圖)

Description In a kindergarten, there are a lot of kids. All girls of the kids know each other and all boys also kno