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通过指定 ...
随机推荐
- 如何使用css影藏滚动条
1.单纯的一句代码: div ::-webkit-scrollbar {width: 0px;}//或者display:none 但是这代码最大的弊端就是只能在webkit内核的浏览器上进行显示,无法 ...
- 上传文件提示IO Error
百度查到的解决办法 http://www.wang0214.com/news/466.html 作者:深圳网站建设 原因: Asp.net中,上传文件的默认大小是4096 KB,也就是4M,不过你可以 ...
- codereviw得到的一些经验
1.设置display为none的元素,它的背景图依然会被下载.所以最好是等到该元素需要显示时才给他加上相应的有背景图的class. 2.css中虽然ID选择器的优先级比较高,效率也比较高,但灵活性差 ...
- PHP 允许Ajax跨域访问 (Access-Control-Allow-Origin)
Ajax访问php,报错 php顶部加上即可: header("Access-Control-Allow-Origin: *");
- 把 Activity 改成 ListActivity继续使用 setContentView
ListActivity has a default layout that consists of a single, full-screen list in the center of the s ...
- Yii2框架添加API Modules
原文链接:http://www.itnose.net/detail/6459353.html : 一.环境部署 1. read fucking Yii Documents. http://www.yi ...
- phpcms输出logo下拉实例
{pc:content action=" siteid="$siteid" order="listorder ASC"} {loop $data $k ...
- poj1961 & hdu1358 Period【KMP】
Period Time Limit: 3000MS Memory Limit: 30000K Total Submissions: 20436 Accepted: 9961 Descripti ...
- poj1952 BUY LOW, BUY LOWER【线性DP】【输出方案数】
BUY LOW, BUY LOWER Time Limit: 1000MS Memory Limit: 30000K Total Submissions:11148 Accepted: 392 ...
- linux加载硬盘过程
查看系统可用磁盘大小: [root@i-mbyar7df ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/sda1 ...