摘要: 题意 有一个4xN的土地,用2x1 和1x2两种去无重叠覆盖,问最多有多少种方案。 思路 最开始我以为是奇数和偶数分别讨论,推出来的公式是(偶数) f[i] = f[2]^(i/2); (奇数)f[i] = 5 f[i 1],推出来不久我就意识到好像貌似是错的。然后暴力把前面的答案找到 1 5 11 阅读全文
posted @ 2018-08-17 09:54 cifiyoo 阅读(85) 评论(0) 推荐(0) 编辑
摘要: Gym 101341A Streets of Working Lanterns 2 题目大意 输入N组字符串,由左右括号组成,问是否每一个括号都可以配对,如果可以输出“YES”并输出字符串的顺序,否则输出“NO”。 思路 定义结构体,然后在输入时利用栈将已配对的括号直接删去,减少不必要的操作,然后重 阅读全文
posted @ 2018-08-17 09:34 cifiyoo 阅读(4) 评论(0) 推荐(0) 编辑
摘要: UVA 12563 (If you smiled when you see the title, this problem is for you ^_^) For those who don’t know KTV, see: http://en.wikipedia.org/wiki/Karaoke_ 阅读全文
posted @ 2018-08-06 10:50 cifiyoo 阅读(85) 评论(0) 推荐(0) 编辑
摘要: UVA 1220 Dear Contestant, I’m going to have a party at my villa at Hali Bula to celebrate my retirement from BCM. I wish I could invite all my co work 阅读全文
posted @ 2018-08-06 10:41 cifiyoo 阅读(196) 评论(0) 推荐(0) 编辑
摘要: UVA 12716 Given an integer N, find how many pairs (A, B) are there such that: gcd(A, B) = A xor B where 1 ≤ B ≤ A ≤ N. Here gcd(A, B) means the greate 阅读全文
posted @ 2018-08-06 10:27 cifiyoo 阅读(128) 评论(0) 推荐(0) 编辑
摘要: HihoCoder 1509 Given a sequence a[1..n], you need to calculate how many integers S satisfy the following conditions: (1). 0 ≤ S typedef long long ll; 阅读全文
posted @ 2018-07-30 09:54 cifiyoo 阅读(130) 评论(0) 推荐(0) 编辑
摘要: CodeForces 1005D Polycarp likes numbers that are divisible by 3. He has a huge number s. Polycarp wants to cut from it the maximum number of numbers t 阅读全文
posted @ 2018-07-30 09:42 cifiyoo 阅读(293) 评论(0) 推荐(0) 编辑
摘要: CodeForces 1006D You are given two strings a and b consisting of lowercase English letters, both of length n. The characters of both strings have indi 阅读全文
posted @ 2018-07-30 09:28 cifiyoo 阅读(205) 评论(0) 推荐(0) 编辑