原创 Codeforces 628D Magic Numbers 數位DP

Consider the decimal presentation of an integer. Let’s call a number d-magic if digit d appears in decimal presenta

原创 Distinct Substrings SPOJ - DISUBSTR

Given a string, we need to find the total number of its distinct substrings. Input T- number of test cases. T<=2

原创 HDU 4417 Super Mario(線段樹離線處理/主席樹)

Mario is world-famous plumber. His “burly” figure and amazing jumping ability reminded in our memory. Now the poor

原创 ccf 201709-4 通信網絡 BFS遍歷

問題描述   某國的軍隊由N個部門組成,爲了提高安全性,部門之間建立了M條通路,每條通路只能單向傳遞信息,即一條從部門a到部門b的通路只能由a向b傳遞信息。信息可以通過中轉的方式進行傳遞,即如果a能將信息傳遞到b,b又能將信息傳遞

原创 Glass Carving CodeForces - 527C

Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already

原创 Palindrome URAL - 1297

The “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent from the compe

原创 CCF201709-3 JSON查詢

問題描述   JSON (JavaScript Object Notation) 是一種輕量級的數據交換格式,可以用來描述半結構化的數據。JSON 格式中的基本單元是值 (value),出於簡化的目的本題只涉及 2 種類型的值:

原创 國慶出遊 HihoCoder - 1041

小Hi和小Ho準備國慶期間去A國旅遊。A國的城際交通比較有特色:它共有n座城市(編號1-n);城市之間恰好有n-1條公路相連,形成一個樹形公路網。小Hi計劃從A國首都(1號城市)出發,自駕遍歷所有城市,並且經過每一條公路恰好兩次

原创 Square HDU - 1518

Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square? Input The fi

原创 APIO2012 Dispatching 左偏樹

在一個忍者的幫派裏,一些忍者們被選中派遣給顧客,然後依據自己的工作獲取報償。在這個幫派裏,有一名忍者被稱之爲 Master。除了 Master以外,每名忍者都有且僅有一個上級。爲保密,同時增強忍者們的領導力,所有與他們工作相關的指

原创 PAT甲級1135 Is It A Red-Black Tree

There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 p

原创 Strange fuction HDU - 2899

Now, here is a fuction: F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100) Can you find the minimum val

原创 PAT甲級1131. Subway Map 最短路/bfs

In the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following

原创 Freedom of Choice URAL - 1517

Background Before Albanian people could bear with the freedom of speech (this story is fully described in the prob

原创 SGU 507 Treediff 啓發式合併

Andrew has just made a breakthrough in complexity theory: he thinks that he can prove P=NP if he can get a data str