码迷,mamicode.com
首页 > 其他好文 > 详细

P2085 最小函数值

时间:2019-10-09 14:03:35      阅读:76      评论:0      收藏:0      [点我收藏+]

标签:spl   play   技术   names   clu   iostream   hide   cout   函数   

技术图片
 1 #include<iostream>
 2 using namespace std;
 3 
 4 int n, m;
 5 int a[10010], b[10010], c[10010];
 6 int x[10010];
 7 
 8 int main()
 9 {
10     cin >> n >> m;
11     for (int i = 1; i <= n; i++)
12     {
13         cin >> a[i] >> b[i] >> c[i];
14         x[i] = 1;
15     }
16     int s = 0;
17     for (int i = 1; i <= m; i++)
18     {
19         int miny = 0x3f3f3f3f;
20         int t = 1;
21         for (int j = 1; j <= n; j++)
22         {
23             if (a[j] * x[j] * x[j] + b[j] * x[j] + c[j] < miny)
24             {
25                 miny = a[j] * x[j] * x[j] + b[j] * x[j] + c[j];
26 
27                 t = j;
28 
29             }
30         }
31         s = miny;
32         cout << miny << " ";
33         x[t]++;
34     }
35     return 0;
36 }
View Code

 

P2085 最小函数值

标签:spl   play   技术   names   clu   iostream   hide   cout   函数   

原文地址:https://www.cnblogs.com/thjkhdf12/p/11641377.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!