P2907 [USACO08OPEN]农场周围的道路Roads Around The Farm

基础dfs,按题意递归即可。

 #include<iostream>
#include<cstdio>
#include<cstring>
#define re register
using namespace std;
int n,k,ans;
void dfs(int x){
if(x<=k||((x-k)&)){//不能有半只奶牛(大雾)
++ans; return;
}dfs((x-k)/); dfs((x-k)/+k);//分成2群
}
int main(){
scanf("%d%d",&n,&k);dfs(n);
printf("%d",ans);
return ;
}

bzoj1621 / P2907 [USACO08OPEN]农场周围的道路Roads Around The Farm的更多相关文章

  1. [USACO08OPEN]农场周围的道路Roads Around The Farm BZOJ 1621 DFS

    Farmer John's cows have taken an interest in exploring the territory around the farm. Initially, all ...

  2. 【洛谷P2907】 【USACO08OPEN】农场周围的道路 水模拟分治

    P2907 [USACO08OPEN]农场周围的道路Roads Around The Farm 题目描述 Farmer John's cows have taken an interest in ex ...

  3. bzoj1605 / P2905 [USACO08OPEN]农场危机Crisis on the Farm

    P2905 [USACO08OPEN]农场危机Crisis on the Farm 发现总步数$k<=30$,考虑用$k$瞎搞 设$f[u][i][j]$表示已经吹$u$次哨,全体奶牛向右走$i ...

  4. 洛谷P2905 [USACO08OPEN]农场危机Crisis on the Farm

    P2905 [USACO08OPEN]农场危机Crisis on the Farm 题目描述 约翰和他的奶牛组建了一只乐队“后街奶牛”,现在他们正在牧场里排练.奶牛们分成一堆 一堆,共1000)堆.每 ...

  5. BZOJ1621: [Usaco2008 Open]Roads Around The Farm分岔路口

    1621: [Usaco2008 Open]Roads Around The Farm分岔路口 Time Limit: 5 Sec  Memory Limit: 64 MBSubmit: 521  S ...

  6. BZOJ 1621: [Usaco2008 Open]Roads Around The Farm分岔路口

    题目 1621: [Usaco2008 Open]Roads Around The Farm分岔路口 Time Limit: 5 Sec  Memory Limit: 64 MB Submit: 56 ...

  7. LGOJ P2921 [USACO08DEC]在农场万圣节Trick or Treat on the Farm

    今天我来给大家带来一片蒟蒻题解 ~~真香 LGOJ P2921  [USACO08DEC]在农场万圣节Trick or Treat on the Farm 题目描述 每年,在威斯康星州,奶牛们都会穿上 ...

  8. 缩点【洛谷P2921】 [USACO08DEC]在农场万圣节Trick or Treat on the Farm

    [洛谷P2921] [USACO08DEC]在农场万圣节Trick or Treat on the Farm 题目描述 每年,在威斯康星州,奶牛们都会穿上衣服,收集农夫约翰在N(1<=N< ...

  9. 「USACO08DEC」「LuoguP2921」在农场万圣节Trick or Treat on the Farm(tarjan

    题意翻译 题目描述 每年,在威斯康星州,奶牛们都会穿上衣服,收集农夫约翰在N(1<=N<=100,000)个牛棚隔间中留下的糖果,以此来庆祝美国秋天的万圣节. 由于牛棚不太大,FJ通过指定 ...

随机推荐

  1. <转>E-M算法

    转自http://blog.csdn.net/zouxy09/article/details/8537620/ 机器学习十大算法之一:EM算法.能评得上十大之一,让人听起来觉得挺NB的.什么是NB啊, ...

  2. LeetCode - Employees Earning More Than Their Managers

    Description: The Employee table holds all employees including their managers. Every employee has an ...

  3. codereviw得到的一些经验

    1.设置display为none的元素,它的背景图依然会被下载.所以最好是等到该元素需要显示时才给他加上相应的有背景图的class. 2.css中虽然ID选择器的优先级比较高,效率也比较高,但灵活性差 ...

  4. Android SharedPreferences保存第一次的信息

    private void setHomeTimeZone() { SharedPreferences prefs = PreferenceManager.getDefaultSharedPrefere ...

  5. 在MacOS上搭建Vulhub漏洞平台环境

    一.安装python3和docker brew install python3 brew cask install docker sudo pip3 install docker-compose 二. ...

  6. redis未授权访问漏洞那拿SHELL

    一.什么是redis未授权访问漏洞: 1.redis是一种文档型数据库,快速高效,存储在内存中,定期才会写磁盘.主要用于快速缓存,数据转存处理等.默认redis开在6379端口,可以直接访问.并不需要 ...

  7. Ensemble Learning

    Ensemble Learning是机器学习里最常见的建模方法,RandomForest 和 GBDT 采用了Ensemble Learning模式,只是具体方法不同. 下面简单翻译下一 https: ...

  8. react路由守卫

    react没有vue那样的路由钩子beforeEach,实现登陆验证. 实现效果:如果没有登陆,就跳转到登陆界面,如果登陆过浏览器存有登陆信息就跳转到所输入的路由界面,如果该路由不存在则跳到404页面 ...

  9. python-social-auth with Django: ImportError: No module named 'social_django' 解决方法

    To use Django with python social auth, you need to install the Django app as well. You can specify t ...

  10. Jenkins升级、迁移、备份

    1.升级 下载新版Jenkins.war文件,替换旧版本war文件,重启即可. Jenkins.war文件的位置一般为/usr/lib/jenkins/Jenkins.war. 2.迁移.备份 Jen ...