直接暴力搜

 /*
 ID: yingzho1
 LANG: C++
 TASK: ratios
 */
 #include <iostream>
 #include <fstream>
 #include <string>
 #include <map>
 #include <vector>
 #include <set>
 #include <algorithm>
 #include <stdio.h>
 #include <queue>
 #include <cstring>
 #include <cmath>
 #include <list>
 #include <cstdio>
 #include <cstdlib>

 using namespace std;

 ifstream fin("ratios.in");
 ofstream fout("ratios.out");

 struct node {
     int x, y, z;
     node(int a, int b, int c) : x(a), y(b), z(c) { }
     node() : x(), y(), z() { }
 };

 ;

 //int f[101][101][101];

 int main()
 {
     node target, s[];
     fin >> target.x >> target.y >> target.z;
     ; i < ; i++)
         fin >> s[i].x >> s[i].y >> s[i].z;
     /*for (int i = 0; i < 101; i++)
         for (int j = 0; j < 101; j++)
             for (int k = 0; k < 101; k++)
                 f[i][j][k] = inf;*/
     int minnum = inf;
     int recx, recy, recz;
     ; i < ; i++) {
         ; j < ; j++) {
             ; k < ; k++) {
                 ].x+j*s[].x+k*s[].x;
                 ].y+j*s[].y+k*s[].y;
                 ].z+j*s[].z+k*s[].z;
                  || xx%target.x == ) && (target.y ==  || yy%target.y == ) && (target.z ==  || zz%target.z == ) && xx*target.y == yy*target.x && yy*target.z == zz*target.y) {
                     int tmp = inf;
                     if (target.x && xx) tmp = xx/target.x;
                     else if (target.y && yy) tmp = yy/target.y;
                     else if (target.z && zz) tmp = zz/target.z;
                     if (tmp < minnum) {
                         minnum = tmp;
                         recx = i, recy = j, recz = k;
                     }
                 }
             }
         }
     }
     if (minnum < inf) fout << recx << " " << recy << " " << recz << " " << minnum << endl;
     else fout << "NONE" << endl;

     ;
 }

USACO Section 3.2: Feed Ratios的更多相关文章

  1. 洛谷P2729 饲料调配 Feed Ratios

    P2729 饲料调配 Feed Ratios 36通过 103提交 题目提供者该用户不存在 标签USACO 难度普及/提高- 提交  讨论  题解 最新讨论 暂时没有讨论 题目背景 农夫约翰从来只用调 ...

  2. USACO Section 1.3 题解 (洛谷OJ P1209 P1444 P3650 P2693)

    usaco ch1.4 sort(d , d + c, [](int a, int b) -> bool { return a > b; }); 生成与过滤 generator&& ...

  3. USACO Section 3.3: Riding the Fences

    典型的找欧拉路径的题.先贴下USACO上找欧拉路径的法子: Pick a starting node and recurse on that node. At each step: If the no ...

  4. USACO Section 4.2 Drainage Ditches(最大流)

    最大流问题.ISAP算法.注意可能会有重边,不过我用的数据结构支持重边.距离d我直接初始化为0,也可以用BFS逆向找一次. -------------------------------------- ...

  5. USACO Section 3.3 Camlot(BFS)

    BFS.先算出棋盘上每个点到各个点knight需要的步数:然后枚举所有点,其中再枚举king是自己到的还是knight带它去的(假如是knight带它的,枚举king周围的2格(网上都这么说,似乎是个 ...

  6. [IOI1996] USACO Section 5.3 Network of Schools(强连通分量)

    nocow上的题解很好. http://www.nocow.cn/index.php/USACO/schlnet 如何求强连通分量呢?对于此题,可以直接先用floyd,然后再判断. --------- ...

  7. USACO Section 5.3 Big Barn(dp)

    USACO前面好像有类似的题目..dp(i,j)=min(dp(i+1,j),dp(i+1,j+1),dp(i,j+1))+1  (坐标(i,j)处无tree;有tree自然dp(i,j)=0) .d ...

  8. USACO Section 1.3 Prime Cryptarithm 解题报告

    题目 题目描述 牛式的定义,我们首先需要看下面这个算式结构: * * * x * * ------- * * * <-- partial product 1 * * * <-- parti ...

  9. USACO Section 1.1 Your Ride Is Here 解题报告

    题目 问题描述 将字符串转变为数字,字母A对应的值为1,依次对应,字母Z对应的值为26.现在有一个字符串,将其中的每个字符转变为数字之后进行累乘,最终的结果对47求余数. 题目给你两个字符串,其中的字 ...

随机推荐

  1. Netsharp快速入门(之7) 基础档案(工作区1 向导创建工作区)

    作者:秋时 杨昶   时间:2014-02-15  转载须说明出处 3.5     商品开发 3.5.1  创建部件工作区 3.5.1.1 工作区向导 1.打开平台工具,选择界面管理节点下的部件工作区 ...

  2. VC6.0装了visual assist x回车键不能补全代码的解决方法

    问题:VC6.0装了visual assist x补全代码具体怎么用?         输入字母后会像输入法那样出现一个菜单        但是怎么选择菜单里面的内容呢?        什么 回车  ...

  3. 博文&零散信息阅读

    关于培养方案: 全国一线高校.网易云课堂和我院培养计划的区别主要体现在: 基础课上,我院删去了物理课程的必修要求. 专业课上,删去了汇编语言.编译原理.信息安全技术等学科的必修要求. 专业选修课上,我 ...

  4. 01.Apache FtpServer配置

    1.解压Apache FTPServer 将下载下来的压缩包(ftpserver-1.0.6.zip)解压到本地,其目录结构如下图: 2.修改users.properties 修改 \apache-f ...

  5. C++ Template之函数模版

    函数模版的定义: template <typename T> T const& max(const T& a,const T b) { return a > b ? ...

  6. PowerDesigner(九)-模型文档编辑器(生成项目文档)(转)

    模型文档编辑器 PowerDesigner的模型文档(Model  Report)是基于模型的,面向项目的概览文档,提供了灵活,丰富的模型文档编辑界面,实现了设计,修改和输出模型文档的全过程. 模型文 ...

  7. ol3简介

    ol3从根本上进行了重新设计,相对于ol2,他符合现代浏览器的一些设计理念,使用了js新的特性,initial版本的目的是支持原来ol2的大多数功能,支持公网上流行的缓存切片,支持常见的矢量数据格式. ...

  8. Unity 3D 游戏上线之后的流水总结

    原地址:http://tieba.baidu.com/p/2817057297?pn=1 首先.unity 灯光烘焙 :Unity 3D FBX模型导入.选项Model 不导入资源球.Rig 不导入骨 ...

  9. What does addScalar do?

    The JavaDoc says: SQLQuery org.hibernate.SQLQuery.addScalar(String columnAlias, Type type) Declare a ...

  10. iOS导航栏-关闭半透明

    self.navigationController.navigationBar.translucent = NO;