layout: post
title: Codeforces Round 269 (Div. 2)
author: "luowentaoaa"
catalog: true
tags:
mathjax: true
- codeforces
C - MUH and House of Cards (数学)
思路
首先每层肯定需要2个作为基础,然后剩下三个作为一个房子
所以我们需要(K)层那就至少需要(n-2*k>0)同时剩下的要可以正好摆成房子也就是((n-2*k)mod3==0)
然后我们就判断木棍能否组成一个K层的房子
首先考虑最优的情况,第一层一个第二层两个...所以第一层需要(2)根
第二层需要(2+3*1)个 第三层需要(2+3*2)个
等差数列求和就是(n>=i*(3*i+1)/2)
开始想二分写,后面发现(i)是平方的也就是直接枚举暴力就行了
D - MUH and Cube Walls (KMP)
思路
差分一下KMP裸题了,很简单了