原创 URAL1091---Tmutarakan Exams(dp)
University of New Tmutarakan trains the first-class specialists in mental arithmetic. To enter the University you s
原创 hdu4135---Co-prime(容斥原理)
Problem Description Given a number N, you are asked to count the number of integers between A and B inclusive whic
原创 Codeforces Round #305 (Div. 2)C---Mike and Frog(擴歐+亂搞)
Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height o
原创 POJ2773---Happy 2006(容斥+二分)
Description Two positive integers are said to be relatively prime to each other if the Great Common Divisor (GCD)
原创 UVA10325--- The Lottery (容斥)
The Sports Association of Bangladesh is in great problem with their latest lottery ‘Jodi laiga Jai’. There are so
原创 LightOJ1002---Country Roads (最短路變形)
I am going to my home. There are many cities and many bi-directional roads between them. The cities are numbered from 0
原创 LightOJ1021---Painful Bases (狀壓dp)
As you know that sometimes base conversion is a painful task. But still there are interesting facts in bases. For conve
原创 LightOJ1013---Love Calculator (dp)
Yes, you are developing a ‘Love calculator’. The software would be quite complex such that nobody could crack the exact
原创 Good Bye 2015 (One University One Question) Round III
A. Red packet 題意: n 個人分m 元的紅包,然後告訴你k 個人獲得的紅包大小,問你如果你想成爲手氣王(錢拿的最多),至少需要得到多大的紅包,或者輸出”Impossible”,如果不可能的話,注意紅包必須分完,並且每個人獲
原创 LightOJ1005---Rooks(簡單組合數學)
A rook is a piece used in the game of chess which is played on a board of square grids. A rook can only move vertically
原创 LightOJ1020(博弈)
Alice and Bob are playing a game with marbles; you may have played this game in childhood. The game is playing by alter
原创 POJ1284---Primitive Roots(求原根個數, 歐拉函數)
Description We say that integer x, 0 < x < p, is a primitive root modulo odd prime p if and only if the set { (xi mod
原创 LightOJ1017---Brush (III) (dp)
Samir returned home from the contest and got angry after seeing his room dusty. Who likes to see a dusty room after a b
原创 LightOJ1006---Hex-a-bonacci(矩陣快速冪)
Given a code (not optimized), and necessary inputs, you have to find the output of the code for the inputs. The code is
原创 LightOJ1016---Brush (II) (貪心)
After the long contest, Samee returned home and got angry after seeing his room dusty. Who likes to see a dusty room af