bzoj1621 / P2907 [USACO08OPEN]农场周围的道路Roads Around The Farm
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的更多相关文章
- [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 ...
- 【洛谷P2907】 【USACO08OPEN】农场周围的道路 水模拟分治
P2907 [USACO08OPEN]农场周围的道路Roads Around The Farm 题目描述 Farmer John's cows have taken an interest in ex ...
- bzoj1605 / P2905 [USACO08OPEN]农场危机Crisis on the Farm
P2905 [USACO08OPEN]农场危机Crisis on the Farm 发现总步数$k<=30$,考虑用$k$瞎搞 设$f[u][i][j]$表示已经吹$u$次哨,全体奶牛向右走$i ...
- 洛谷P2905 [USACO08OPEN]农场危机Crisis on the Farm
P2905 [USACO08OPEN]农场危机Crisis on the Farm 题目描述 约翰和他的奶牛组建了一只乐队“后街奶牛”,现在他们正在牧场里排练.奶牛们分成一堆 一堆,共1000)堆.每 ...
- BZOJ1621: [Usaco2008 Open]Roads Around The Farm分岔路口
1621: [Usaco2008 Open]Roads Around The Farm分岔路口 Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 521 S ...
- 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 ...
- LGOJ P2921 [USACO08DEC]在农场万圣节Trick or Treat on the Farm
今天我来给大家带来一片蒟蒻题解 ~~真香 LGOJ P2921 [USACO08DEC]在农场万圣节Trick or Treat on the Farm 题目描述 每年,在威斯康星州,奶牛们都会穿上 ...
- 缩点【洛谷P2921】 [USACO08DEC]在农场万圣节Trick or Treat on the Farm
[洛谷P2921] [USACO08DEC]在农场万圣节Trick or Treat on the Farm 题目描述 每年,在威斯康星州,奶牛们都会穿上衣服,收集农夫约翰在N(1<=N< ...
- 「USACO08DEC」「LuoguP2921」在农场万圣节Trick or Treat on the Farm(tarjan
题意翻译 题目描述 每年,在威斯康星州,奶牛们都会穿上衣服,收集农夫约翰在N(1<=N<=100,000)个牛棚隔间中留下的糖果,以此来庆祝美国秋天的万圣节. 由于牛棚不太大,FJ通过指定 ...
随机推荐
- 《转》python学习(4)对象
转自http://www.cnblogs.com/BeginMan/p/3160044.html 一.学习目录 1.pyhton对象 2.python类型 3.类型操作符与内建函数 4.类型工厂函数 ...
- Objective-c官方文档翻译 类的定义
类是对象的蓝图. 一个类是描述了对象的行为和属性.例如NSString的一个实例.他的类提供了各种的方法来转化和表示他的内部字符的表示. 每个类的实例都包含了这个类的属性和行为.例如每个NSSt ...
- Android N 7 【 classes.dex】反编译失败:com.googlecode.d2j.DexException: not support version.
Microsoft Windows [版本 6.1.7601]版权所有 (c) 2009 Microsoft Corporation.保留所有权利. D:\Android反编译工具[全]\2016\d ...
- POJ3259-负权回路判定
题目:http://vj.acmclub.cn/contest/view.action?cid=316#problem/E 首先要理解题意:其实就是给你一个图让你判断有没有负权回路 因此直接用Ball ...
- log4net类库配置、WebService配置
一.类库配置 结构如下图 1.LogUtility类 public class LogUtility { private static readonly log4net.ILog log = log4 ...
- 下载组件Jspsmartupload中文乱码解决办法
先用jdgui反编译jar包,得到源码,然后将源码拷贝到myeclipse中,注意路径是按照源码的路径 打开默认会有错误提示,稍微改改就解决了 1,打开“ SmartUpload.java ”,查 ...
- 170704、springboot编程之CommandLineRunner
实际应用中,我们会有在项目服务启动的时候就去加载一些数据或做一些事情这样的需求. 为了解决这样的问题,Spring Boot 为我们提供了一个方法,通过实现接口 CommandLineRunner 来 ...
- C++ string append方法的常用用法
append函数是向string的后面追加字符或字符串. 1).向string的后面加C-string string s = “hello “; const char *c = “out here “ ...
- Java web项目配置相关
引申 XML 命名空间(XML Namespaces) XML Schema 教程 XSD(XML Schema Definition) XML Schema 语言也称作 XML Schema 定义. ...
- Fast and Accurate Traffic Matrix Measurement Using Adaptive Cardinality Counting
paper-CaiPan.pdf http://conferences.sigcomm.org/sigcomm/2005/paper-CaiPan.pdf