原创 L - 修改字符串
給定兩個字符串S和T,每次小Ho可以對S進行以下操作: 選定S中的一個字符Si,將Si移動到字符串首位。 例如對於S="ABCD",小Ho可以選擇移動B從而得到新的S="BACD";也可以選擇移動C得到"CABD";也可以選擇移動D得
原创 跳石頭
有 n 個石頭從左到右拍成一排,第 i 個石頭的顏色爲 ci 。現在小 Ho 在第一個石頭,他想跳到第 n 個石頭,每一步有兩種跳躍方式: 1. 從第 i 個石頭跳到第 i+1 個石頭 2. 跳到右邊第一個和當前石頭顏色相同的石頭(如
原创 O - XOR
You are given non-negative integers x, k. Please compute how many non-negative y satisfy y + (x xor y) = x + k. Here +
原创 拼三角形
給定 n 根木棍,第 i 根長度爲 ai 現在你想用他們拼成儘量多的面積大於 0 的三角形,要求每根木棍只能被用一次,且不能折斷 請你求出最多能拼出幾個 Input 第一行一個正整數 n 第二行 n 個正整數 a1 … an 1 ≤ n
原创 W - 最短公共子序列
給定一個 01 串 A,你需要找一個和它等長的01串 B,使得 A 和 B 的最長公共子序列最短 爲了方便,你不需要輸出 B,你只需要輸出 A 和 B 的最長公共子序列的長度 Input 第一行一個 01 串 A 1 ≤ |A| ≤ 10
原创 題目分類
DP: 1011 NTA 簡單題 1013 Great Equipment 簡單題 1024 Calendar Game 簡單題 1027 Human Gene
原创 R - 數字遊戲2
小 Hi 有一個數字 k,小 Hi 可以對他進行多次變換:每次變換選擇 k 的一個大於 1 的約數 d,然後將 k 變成 k/d 現在小 Hi 想將一個數字變成 1,求操作的方案數。由於方案數可能過大,你只需要輸出方案數對 109+7 取
原创 F - Diverse Substring
You are given a string ss, consisting of nn lowercase Latin letters. A substring of string ss is a continuous segment o
原创 E - Again Palindrome
A palindorme is a sequence of one or more characters that reads the same from the left as it does from the right. For e
原创 I - Berland Fair
XXI Berland Annual Fair is coming really soon! Traditionally fair consists of nn booths, arranged in a circle. The bo
原创 String Game
Little Nastya has a hobby, she likes to remove some letters from word, to obtain another word. But it turns out to be p
原创 D - Matrix Walk
There is a matrix A of size x × y filled with integers. For every , Ai, j = y(i - 1) + j. Obviously, every integer from
原创 U - 特工配對
在 A 國有一個祕密特工組織,這個特工組織是由若干對雙人組合構成的 現在特工組織有一批新人加入,爲了防止背叛,組織規定來自相同城市的人不能配對在一起 現在已知 A 國有 n 個城市,且新人中來自第 i 個城市的有 ai 人,求最多組成幾個
原创 G - Vasya and Books
Vasya has got nn books, numbered from 11 to nn , arranged in a stack. The topmost book has number a1a1 , the next one —
原创 C - String Typing
You are given a string s consisting of n lowercase Latin letters. You have to type this string using your keyboard. Ini