随笔分类 - ACM算法
摘要:There is an N*M matrix with only 0s and 1s, (1 <= N,M <= 1000). An exact cover is a selection of rows such that every column has a 1 in exactly one of
阅读全文
摘要:题目描述 给你一个合法的括号序列s1,每次你可以删除一个"()" 你可以删除0个或者多个"()" 求能否删成另一个括号序列s2 输入描述: 第一行输入一个字符串s (2 ≤ |s| ≤ 100)第二行输入一个字符串t (2 ≤ |t| ≤ 100 ) 输出描述: 如果可以输出"Possible"否则
阅读全文
摘要:题目描述 给你一个长度为50的数字串,问你有多少个子序列构成的数字可以被3整除 答案对1e9+7取模 输入描述: 输入一个字符串,由数字构成,长度小于等于50 输出描述: 输出一个整数 示例1 输入 132 输出 3 示例2 输入 9 输出 1 示例3 输入 333 输出 7 示例4 输入 1234
阅读全文
摘要:Por Costel the Pig has received a royal invitation to the palace of the Egg-Emperor of Programming, Azerah. Azerah had heard of the renowned pig and w
阅读全文
摘要:People in Silverland use coins.They have coins of value A1,A2,A3...An Silverland dollar.One day Tony opened his money-box and found there were some co
阅读全文
摘要:People in Silverland use coins.They have coins of value A1,A2,A3...An Silverland dollar.One day Tony opened his money-box and found there were some co
阅读全文
摘要:Keeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow an electronic ID
阅读全文
摘要:Keeping track of all the cows can be a tricky task so Farmer John has installed a system to automate it. He has installed on each cow an electronic ID
阅读全文
摘要:Bessie is such a hard-working cow. In fact, she is so focused on maximizing her productivity that she decides to schedule her next N (1 ≤ N ≤ 1,000,00
阅读全文
摘要:It is a little known fact that cows love apples. Farmer John has two apple trees (which are conveniently numbered 1 and 2) in his field, each full of
阅读全文
摘要:Let's play a card game called Gap. You have 28 cards labeled with two-digit numbers. The first digit (from 1 to 4) represents the suit of the card, an
阅读全文
摘要:On Children's Day, the child got a toy from Delayyy as a present. However, the child is so naughty that he can't wait to destroy the toy. The toy cons
阅读全文
摘要:给你一个n*m的方格图表示一个博物馆的分布图.每个方格上用'*'表示墙,用'.'表示空位.每一个空格和相邻的墙之间都有一幅画.(相邻指的是上下左右相邻).你可以从一个空格的位置走到相邻的空格位置.现在你给你若干个(xi,yi)形式的询问,表示你现在在(xi,yi)这个位置(保证为空位)出发,问你从这
阅读全文
摘要:幻方是一种很神奇的 N*N 矩阵:它由数字 1,2,3,.....N x N 构成,且每行、每列及两条对角线上的数字之和都相同。当 N 为奇数时,我们可以通过下方法构建一个幻方:首先将 1 写在第一行的中间。之后,按如下方式从小到大依次填写每个数 K (K=2,3,...,N x N) :1.若 (
阅读全文
摘要:As you could know there are no male planes nor female planes. However, each plane on Earth likes some other plane. There are n planes on Earth, number
阅读全文
摘要:Farmer John commanded his cows to search for different sets of numbers that sum to a given number. The cows use only numbers that are an integer power
阅读全文
摘要:The cows don't use actual bowling balls when they go bowling. They each take a number (in the range 0..99), though, and line up in a standard bowling-
阅读全文
摘要:Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea
阅读全文
摘要:Farmer John went to cut some wood and left N (2 ≤ N ≤ 100,000) cows eating the grass, as usual. When he returned, he found to his horror that the clus
阅读全文
摘要:Our chemical biologists have invented a new very useful form of life called stripies (in fact, they were first called in Russian - polosatiki, but the
阅读全文

浙公网安备 33010602011771号