直接暴力搜

 /*
 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. WebSocket学习

    在HTML5规范中,我最喜欢的Web技术就是正迅速变得流行的WebSocket API.WebSocket提供了一个受欢迎的技术,以替代我们过去几年一直在用的Ajax技术.这个新的API提供了一个方法 ...

  2. 对git的初步认识

    虽然经常听说博客,但是却是第一次用.就像,虽然经常见电脑,但是却第一次接触软件.对于git也是一样,从来没听过,更不了解. 因为自己私下也没有去过多的了解,所以对于git只有一些有关书面资料的很片面的 ...

  3. Matlab绘制透明平面(二元函数)

    一.需求来源 对空间结构聚类,恰好是圆台,找到了上下底面的方程,所以画图. 二.需求解决 2.1 绘制平面 x = linspace(0,5,100); y = linspace(0,4,100); ...

  4. vsm 的理解

    vsm相对于最原始的sm多了这样一个部分 if(depthcampare <=zInSM) fPercentLit  = 1;//noshadow; else { variance = zzIn ...

  5. java socket 一个服务器对应多个客户端,可以互相发送消息

    直接上代码,这是网上找的demo,然后自己根据需求做了一定的修改.代码可以直接运行 服务器端: package socket; import java.io.BufferedReader; impor ...

  6. ASP.NET 大文件上传的简单处理

    在 ASP.NET 开发的过程中,文件上传往往使用自带的 FileUpload 控件,可是用过的人都知道,这个控件的局限性十分大,最大的问题就在于上传大文件时让开发者尤为的头疼,而且,上传时无法方便的 ...

  7. jQuery中的Deferred-详解和使用

    首先,为什么要使用Deferred? 先来看一段AJAX的代码: var data; $.get('api/data', function(resp) { data = resp.data; }); ...

  8. Python中的两种列表

    python中有两种类型的列表:其中一种是用[]创建的列表,这种列表具有伸缩性,可以动态改变,而另外一种列表是用()创建,成为元组,元组一旦创建,在任何状况下都不能再改变,是一种常量列表. movie ...

  9. Python Tricks 若干

    赵斌 - APRIL 29, 2015 在 python 代码中可以看到一些常见的 trick,在这里做一个简单的小结. json 字符串格式化 在开发 web 应用的时候经常会用到 json 字符串 ...

  10. Redis与Memcached的incr/decr差异对比

    目前广泛使用的分布式缓存Redis和Memcached均支持对整数型Value值的增减,对应到具体命令中就是incr和decr命令. incr/decr是原子性操作(memcached 1.2.4及以 ...