博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
USACO Section 2.1 Healthy Holsteins
阅读量:7057 次
发布时间:2019-06-28

本文共 1054 字,大约阅读时间需要 3 分钟。

/*ID: lucien23PROG: holsteinLANG: C++*/#include 
#include
#include
using namespace std;bool compFun(int x, int y){ int temp, i = 0; while (true) { temp = 1 << i; if (temp&x > temp&y) { return true; } else if (temp&x < temp&y) { return false; } i++; }}int main(){ ifstream infile("holstein.in"); ofstream outfile("holstein.out"); if(!infile || !outfile) { cout << "file operation failure!" << endl; return -1; } int arrCnt[15] = {1,3,7,15,31,63,127,255,511,1023,2047,4095,8191,16383,32767}; int V; infile >> V; int *minRequire = new int[V]; for (int i=0; i
> minRequire[i]; } int G; infile >> G; int **feeds = new int *[G]; for (int i=0; i
> feeds[i][j]; } } int minScoopsCnt = 16; int minScoops = 0; int *sumVita = new int[V]; int sumScoops; for (int i=1; i<=arrCnt[G-1]; i++) {//穷举遍历每一种方案 for (int k=0; k
<< j; if ((temp & i) == temp) {//包括类型j for (int k=0; k
<< j; if ((temp & minScoops) == temp) { outfile << " " << j+1; } } outfile << endl; return 0;}

转载地址:http://sqrol.baihongyu.com/

你可能感兴趣的文章
webdriver鼠标上下滑动
查看>>
WordPress版微信小程序2.4版发布
查看>>
区域极大值—lhMorpRMax
查看>>
关于使用HttpModule模块处理登录验证示例
查看>>
css字体样式(Font Style),属性
查看>>
C#中AppDomain.CurrentDomain.BaseDirectory与Application.StartupPath的区别
查看>>
Java--调试--单步调试,断言,单元测试
查看>>
Sicily 4495. Print permutations
查看>>
silverlight 对ChildWindow返回给父窗体值的理解(转载)
查看>>
大数据量高并发的数据库优化(转)
查看>>
motion的移植和使用
查看>>
css 去除页面双击事件
查看>>
Android View 之进度条+拖动条+星级评论条....
查看>>
Atitit.html解析器的选型 jsoup nsoup ,java c# .net 版本
查看>>
Android解析JSON速度对比
查看>>
javascipt继承机制(from阮一峰)
查看>>
Atitit.http连接合并组件 ConnReducerV3 新特性
查看>>
Android USB Gadget复合设备驱动(打印机)测试方法
查看>>
Windows 7下配置JDK环境变量和Java环境变量配置
查看>>
linux 修改 elf 文件的dynamic linker 和 rpath
查看>>