USACO: Feed Ratios

实战教程:用DETR+超分辨率搞定红外小目标检测(附完整代码) 本文提供了一套完整的红外小目标检测实战方案,通过融合EDSR超分辨率技术与改进型DETR深度学习算法,有效解决了红外图像中小目标检测的难题。文章详细介绍了从环境搭建、数据预处理、模型定制(如引入EMA注意力与S2特征层)到训练调优的全流程,并附有完整代码,旨在帮助开发者将前沿算法高效落地于安防、自动驾驶等实际场景。 阅读详情
Feed Ratios
1998 ACM Finals, Dan Adkins

Farmer John feeds his cows only the finest mixture of cow food, which has three components: Barley, Oats, and Wheat. While he knows the precise mixture of these easily mixable grains, he can not buy that mixture! He buys three other mixtures of the three grains and then combines them to form the perfect mixture.

Given a set of integer ratios barley:oats:wheat, find a way to combine them IN INTEGER MULTIPLES to form a mix with some goal ratio x:y:z.

For example, given the goal 3:4:5 and the ratios of three mixtures:

        1:2:3
        3:7:1
        2:1:2

your program should find some minimum number of integer units (the `mixture') of the first, second, and third mixture that should be mixed together to achieve the goal ratio or print `NONE'. `Minimum number' means the sum of the three non-negative mixture integers is minimized.

For this example, you can combine eight units of mixture 1, one unit of mixture 2, and five units of mixture 3 to get seven units of the goal ratio:

    8*(1:2:3) + 1*(3:7:1) + 5*(2:1:2) = (21:28:35) = 7*(3:4:5)

Integers in the goal ratio and mixture ratios are all non-negative and smaller than 100 in magnitude. The number of units of each type of feed in the mixture must be less than 100. The mixture ratios are not linear combinations of each other.

PROGRAM NAME: ratios

INPUT FORMAT

Line 1: Three space separated integers that represent the goal ratios
Line 2..4: Each contain three space separated integers that represent the ratios of the three mixtures purchased.

SAMPLE INPUT (file ratios.in)

3 4 5
1 2 3
3 7 1
2 1 2

OUTPUT FORMAT

The output file should contain one line containing four integers or the word `NONE'. The first three integers should represent the number of units of each mixture to use to obtain the goal ratio. The fourth number should be the multiple of the goal ratio obtained by mixing the initial feed using the first three integers as mixing ratios.

SAMPLE OUTPUT (file ratios.out)

8 1 5 7

 
解题思路:

赤果果的线性方程组,增广矩阵是3行5列的(aix + biy + ciz - sik = 0),所以有一个自由变量,我们把自由变量设为k,并试图用k来表示x、y、z,所以可以找到通解表达式,并得到最小正整数解。

N[]、D[]表示k前面的分数的分子分母(这样做是为了消除计算误差),因为矩阵只有三行,我勉为其难自己笔算了一下最终表达式,看起来挺蛋疼的……

出乎意料的,有一组数据在矩阵运算中超过了int范围,我太大意了,wa了一次。

芒果YOLO11改进23:主干Backbone篇GhostNet:原创改进高效 GhostNet 网络,华为出品,打造全新检测器 主干Backbone篇GhostNet:原创改进高效 GhostNet 网络,华为出品,打造全新检测器 阅读详情

相关推荐

微信小程序协同工作和发布

微信小程序协同工作和发布

qq_53114527的博客 1620

USACO3.24Feed Ratios

直接枚举到100水过 1 /* 2 ID: shangca2 3 LANG: C++ 4 TASK: ratios 5 */ 6 #include <iostream> 7 #include<cstdio> 8 #include<cstring> 9 #include<algori...

weixin_30820151的博客 120

【超详细】基于YOLOv8的PCB缺陷检测

印刷电路板(PCB)瑕疵数据集:是一个公共的合成PCB数据集,由北京大学发布,其中包含1386张图像以及6种缺陷(缺失孔,鼠标咬伤,开路,短路,杂散,伪铜),用于检测,分类和配准任务。本文我们选取了其中适用与检测任务的693张图像,随机选择593张图像作为训练集,100张图像作为验证集。

weixin_45679938的博客 2万+

usaco3.2.4 Feed Ratios

一 原题 Feed Ratios 1998 ACM Finals, Dan Adkins Farmer John feeds his cows only the finest mixture of cow food, which has three components: Barley, Oats, and Wheat. While he knows the precise mixtur

max_kibble的博客 495

【NTN 卫星通信】使用地面网络和卫星网络接入的终端应用场景

卫星接入有广覆盖的特点, 可以改善地面接入网覆盖或无线条件差的地区(例如多径干扰)的服务可用性。对于高速移动中需要实时业务的终端,如IMS语音/视频会议,可以通过地面接入和卫星接入同时实现与5G系统的双连接,在地面接入网不可用的情况下获得连续可靠的业务。

weixin_43603524的博客 2558

昇腾Atlas Duo 300I推理卡实战:从零部署Qwen大模型推理服务

本文详细记录了在华为昇腾Atlas Duo 300I推理卡上,从零部署Qwen1.5-14B-Chat大模型推理服务的完整实战过程。涵盖环境准备、MindIE容器配置、CANN工具链安装、服务启动与API测试等关键步骤,并分享了性能观察与排错经验,为国产AI算力平台部署LLM推理服务提供了实用指南。

weixin_29084231的博客 1238

Feed Ratios_usaco3.2_暴力

题目描述 Description农夫约翰从来只用调配得最好的饲料来喂他的奶牛。饲料用三种原料调配成:大麦,燕麦和小麦。他知道自己的饲料精确的配比,在市场上是买不到这样的饲料的。他只好购买其他三种混合饲料(同样都由三种麦子组成),然后将它们混合,来调配他的完美饲料。给出三组整数,表示 大麦:燕麦:小麦 的比例,找出用这三种饲料调配 x:y:z 的饲料的方法。例如,给出目标饲料 3:4:5 和三种饲料的

olahiuj的博客 378

基于YOLOv10的微小目标检测,多头检测器提升小目标检测精度

引入多头检测器助力YOLOv10,暴力提升小目标检测性能

①答疑群聊服务;②YOLO大模型知识问答系统;③计算机视觉论文生成智能体; 2569

【USACO题库】3.2.4 Feed Ratios饲料调配

【USACO题库】3.2.4 Feed Ratios饲料调配 (Standard IO) 时间限制: 1000 ms 空间限制: 262144 KB 具体限制 题目描述农夫约翰从来只用调配得最好的饲料来为他的奶牛。饲料用三种原料调配成:大麦,燕麦和小麦。他知道自己的饲料精确的配比,在市场上是买不到这样的饲料的。他只好购买其他三种混合饲料(同样都由三种麦子组成),然后将它们混合,来调配他的完

wangyuda123456789的博客 691

高斯过程的数学理解

G澳大利亚的过程是有益的,特别是当我们有少量数据时。当我在制造业担任数据科学家时,我们的团队使用这种算法来揭示我们接下来应该进行哪些实验条件。但是,此算法不如其他算法流行。在这篇博客中,我将通过可视化和 Python 实现来解释高斯过程 [1] 的数学背景。

gongdiwudu的专栏 3606

Hindsight 内存爆炸 4 个词排查清单:9,284 条 6 成是 SSH 调试日志——Agent 标签系统的实战复盘

9,284 条记忆里 66% 是 SSH 调试日志。4 个标签被滥用=0 区分度。3 个 entity_labels + retain_mission + retain_every_n_turns 配置把噪声压回 5%——附 PATCH 脚本和实测前后数据。

Starry-SkyJing的博客 57

USACO Feed Ratios, Magic Squares

本质上讲,这两道题都是数学题,ratios是行列式解线性方程组,squares是组合数学。可见ACMer数学基础好确实是非常重要的。 1、Feed Ratios 所求的实际上就是一个最简配比 x, y, z, w,使得 x(a1,b1,c1) + y(a2,b2,c2) + z(a3,b3,c3) = w(g1,g2,g3),我线性代数也忘得差不多了,不过对克莱姆法则还有一点印象。

左手为你画情 3710

计算机控制技术及应用

《计算机控制技术及应用》通过总结作者的科研成果和吸收国内外的先进理论、方法和技术,以计算机控制系统的网络化、开放化、智能化和集成化发展趋势为主线索,主要介绍计算机控制系统的基本概念和计算机控制系统的典型形式,计算机控制系统的数学描述与基本分析方法,以及数字PID控制器、最少拍控制系统、达林算法、状态变量设计法等设计方法及其各种改进算法。重点突出计算机控制系统输入输出通道接口的设计方法和典型控制系统的设计案例与实现方法等。

USACO Feed Ratios 解题报告

/* ID: thestor1 LANG: C++ TASK: ratios */ #include #include #include #include #include #include #include #include using namespace std; int gcd(int a, int b) { if(b == 0) { return a; }

thestoryofsnow的专栏 1042

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

USACO Feed Ratios

1、这是98年的一道ACM的Final题目,可以暴力枚举,但是我想试试用高斯消元求非负整数解,所以就写了一个比较长的代码(当然运行时间很短)。 2、要注意,由于是求非负整数解,在两行相减的时候,其第一个数不一定是成倍数关系,所以要利用最小公倍数。注意此时循环应从0到n,否则会漏掉一些地方。计算后再将整行除以最大公因数,防止数字过大导致溢出。 3、最后还是要吐槽下:谁说USACO Trainin

465

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

【搜索】【USACO】Feed Ratios

<br /> <br />Farmer John feeds his cows only the finest mixture of cow food, which has three components: Barley, Oats, and Wheat. While he knows the precise mixture of these easily mixable grains, he can not buy that mixture! He buys three other mixtures o

liveas的专栏 930

usaco Feed Ratios

一开始没看清100以内的限制没法下手百度后发现他们都说100以内回去又把题读了读。。。。。理解能力有点问题。。。 数字很小就简单了枚举。。。注意0注意0注意0。我被坑死了开始写好一个没考虑0,wa了发现考虑0后太麻烦了没办法又换种方法重写了重写了。 /* Id: jinbo wu TASK:ratios LANG:C++ */ #include using namespace std; int

silence401的博客 313

USACO 3.2.4 feed ratios

<br />  复习了一下自主招生时学的行列式求解方程组,也就是克莱姆定则的应用。<br /> <br />/* ID: wangqia6 TASK: ratios LANG: C++ */ #include <fstream> using namespace std; const int N = 3; const int M = 4; long b[M],a[M][M],c[M][M]; long det(long a[][M]) { return a[1][1]

inc(Arthur's fighting) 646

[USACO]Feed Ratios

题意:告诉你目标饲料的原料的用量,问你有三种饲料,没种原料比例都不同,问你是否能配比出目标饲料 解题思路:纯暴力 解题代码: 1 // File Name: ratios1.c 2 // Author: darkdream 3 // Created Time: 2014年03月18日 星期二 08时33分08秒 4 /* 5 ID: dream.y1 6 PRO...

weixin_30340617的博客 159

打卡信奥刷题(1240)用C++实现信奥 P2729 [USACO3.2] 饲料调配 Feed Ratios

农夫约翰从来只用调配得最好的饲料来喂他的奶牛。饲料用三种原料调配成:大麦,燕麦和小麦。他知道自己的饲料精确的配比,在市场上是买不到这样的饲料的。他只好购买其他三种混合饲料(同样都由三种麦子组成),然后将它们混合,来调配他的完美饲料。

Loge谈信奥--一个专注于信奥人的博客 5496

USACO 3.2 Feed Ratios (ratios)

/* Main idea Enumeration, because there are 100^3 cases; Note the case where ratios may be 0; */ /* ID: haolink1 PROG: ratios LANG: C++ */ //#include #include using namespace std; int goal[3]; in

Hello World! 1553

USACO Training Section 3.2 Feed Ratios

[url="http://ace.delos.com/usacoprob2?a=JbTv7diNbha&S=ratios"]英文原题[/url] [url="http://www.wzoi.org/usaco/14%5C403.asp"]中文题译[/url] 大意:给出整数a[i][j]和b[i],i,j=1,2,3,有X={x[i]|i=1,2,3,s.t 存在y,对j=1,2...

山中竹笋 189

USACO-Section 3.2 Feed Ratios(枚举)

范围依旧很小,枚举即可

idealism_xxm的专栏 568

【例题】【高斯消元】USACO3.2.4 Feed Ratios

NKOJ1828 【USACO3.2.4】Feed Ratios饲料调配 时间限制 : 10000 MS 空间限制 : 65536 KB问题描述 农夫约翰从来只用调配得最好的饲料来喂他的奶牛。饲料用三种原料调配成:大麦,燕麦和小麦。他知道自己的饲料精确的配比,在市场上是买不到这样的饲料的。他只好购买其他三种混合饲料(同样都由三种麦子组成),然后将它们混合,来调配他的完美饲料。 给出三组

ANG 644

USACO 3.2 Feed Ratios

TASK: ratiosLANG: C++Compiling...Compile: OKExecuting... Test 1: TEST OK [0.027 secs, 3028 KB] Test 2: TEST OK [0.027 secs, 3028 KB] Test 3: TEST OK [0.027 secs, 3028 KB] Test 4: TEST OK ...

weixin_30872789的博客 94

USACO--3.2Feed Ratios

WF上的水题,直接模拟即可.注意为0情况的处理,我写的有点复杂了.代码如下:/* ID: 15674811 LANG: C++ TASK: ratios */#include<iostream> #include<cstdio> #include<cstring> using namespace std;#define INF 0x3f3f3f3fint xx[5],yy[5],zz[5],k4,s

荒野孤鹰 841
上一篇: USACO: Stringsobits
下一篇: USACO: Magic Squares
Geterns
博客等级 码龄17年 16粉丝 77原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值