2013-7-18

Many graduate students of Peking University are living in Wanliu Campus, which is 4.5 kilometers from the main campus - Yanyuan. Students in Wanliu have to either take a bus or ride a bike to go to school. Due to the bad traffic in Beijing, many students choose to ride a bike. 
We may assume that all the students except "Charley" ride from Wanliu to Yanyuan at a fixed speed. Charley is a student with a different riding habit - he always tries to follow another rider to avoid riding alone. When Charley gets to the gate of Wanliu, he will look for someone who is setting off to Yanyuan. If he finds someone, he will follow that rider, or if not, he will wait for someone to follow. On the way from Wanliu to Yanyuan, at any time if a faster student surpassed Charley, he will leave the rider he is following and speed up to follow the faster one. 
We assume the time that Charley gets to the gate of Wanliu is zero. Given the set off time and speed of the other students, your task is to give the time when Charley arrives at Yanyuan. 
 

Input

There are several test cases. The first line of each case is N (1 <= N <= 10000) representing the number of riders (excluding Charley). N = 0 ends the input. The following N lines are information of N different riders, in such format:
Vi [TAB] Ti 
Vi is a positive integer <= 40, indicating the speed of the i-th rider (kph, kilometers per hour). Ti is the set off time of the i-th rider, which is an integer and counted in seconds. In any case it is assured that there always exists a nonnegative Ti. 
 

Output

Output one line for each case: the arrival time of Charley. Round up (ceiling) the value when dealing with a fraction.
 

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

 int n;  

while(cin>>n &&n != 0)

 {     

  int *a =  new int[n];

    int *b =  new int[n];

    int minTime = 9999999;

    for(int i = 0 ; i < n;i++)

    {      

    cin>>a[i]>>b[i];  

     }

    for(int i = 0;i<n;i++)  

   {    

      if((ceil(16200.0/a[i]) + b[i] < minTime)&& b[i]>=0)     

    {      

       minTime = ceil(16200.0/a[i]) + b[i];   

       }

    }

     cout<<minTime<<endl;

   }    

     return 0;

}

 
 

Description

As you know, Gardon trid hard for his love-letter, and now he's spending too much time on choosing flowers for Angel. When Gardon entered the flower shop, he was frightened and dazed by thousands kinds of flowers.  "How can I choose!" Gardon shouted out. Finally, Gardon-- a no-EQ man decided to buy flowers as many as possible. Can you compute how many flowers Gardon can buy at most?
 

Input

Input have serveral test cases. Each case has two lines. The first line contains two integers: N and M. M means how much money Gardon have. N integers following, means the prices of differnt flowers.
 

Output

For each case, print how many flowers Gardon can buy at most. You may firmly assume the number of each kind of flower is enough.
 
 
#include <iostream>

using namespace std;
void quickSort(int *a,size_tleft,size_tright)
{
    size_tp = (left + right)/2;
    int key = a[p];
    for(size_ti = left,j = right; i < j;)
    {
        while(!(key < a[i] || p < i))
            i++;
        if(i < p)
        {
            a[p] = a[i];
            p = i;
        }
        while(j>0 && !(j < p || a[j] < key))
            j--;
         if(p < j)
         {
             a[p] = a[j];
             p = j;
         }
     }
     a[p] = key;
     if(p - left > 1)
         quickSort(a,left,p-1);
     if(right - p > 1)
         quickSort(a,p + 1, right);
}
int main()
{
         int n,m;
         while(cin>>n>>m)
         {
            int *flower = new int [n];
            for(int i = 0 ; i < n; i++)
            cin>>flower[i];
            quickSort(flower,0,n);
         cout<<m/flower[0]<<endl;
         }
    return 0;
}
 
 
 
The knights explained: "To slay the dragon, we must chop off all its heads. Each knight can chop off one of the dragon's heads. The heads of the dragon are of different sizes. In order to chop off a head, a knight must be at least as tall as the diameter of the head. The knights' union demands that for chopping off a head, a knight must be paid a wage equal to one gold coin for each centimetre of the knight's height." 
Would there be enough knights to defeat the dragon? The king called on his advisors to help him decide how many and which knights to hire. After having lost a lot of money building Mir Park, the king wanted to minimize the expense of slaying the dragon. As one of the advisors, your job was to help the king. You took it very seriously: if you failed, you and the whole kingdom would be burnt to a crisp! 
 

Input

The input contains several test cases. The first line of each test case contains two integers between 1 and 20000 inclusive, indicating the number n of heads that the dragon has, and the number m of knights in the kingdom. The next n lines each contain an integer, and give the diameters of the dragon's heads, in centimetres. The following m lines each contain an integer, and specify the heights of the knights of Loowater, also in centimetres.  The last test case is followed by a line containing:  0 0
 

Output

For each test case, output a line containing the minimum number of gold coins that the king needs to pay to slay the dragon. If it is not possible for the knights of Loowater to slay the dragon, output the line:  Loowater is doomed!
//循环跳出后的输出要注意!!!!
#include <iostream>
using namespace std;
void quickSort(int *a,size_tleft,size_tright)
{
    size_tp = (left + right)/2;
    int key = a[p];
    for(size_ti = left,j = right; i < j;)
    {
        while(!(key < a[i] || p < i))
            i++;
        if(i < p)
        {
            a[p] = a[i];
            p = i;
        }
        while(j>0 && !(j < p || a[j] < key))
            j--;
         if(p < j)
         {
             a[p] = a[j];
             p = j;
         }
     }
     a[p] = key;
     if(p - left > 1)
         quickSort(a,left,p-1);
     if(right - p > 1)
         quickSort(a,p + 1, right);
}
int main()
{
    int m,n;
    while(cin>>n>>m && m && n)
    {
        int *a = new int[n];
        int *b = new int[m];
       for(int i = 0; i< n;i++)
       {
           cin>>a[i];
       }
       for(int i = 0 ; i < m;i++)
       {
           cin>>b[i];
       }
       quickSort(a,0,n);
       quickSort(b,0,m);
       int money = 0;
       if(m<n || a[0] >b[m-1])
       {
           cout<<"Loowater is doomed!"<<endl;
       }
       else
       {
          int z=1;
           for(int i = 0, j = 0; i < m,j < n; )
           {
               if(m-i < n-j)
               {
                   z=0;
                   cout<<"Loowater is doomed!"<<endl;
                   break;
               }

               if(b[i]>= a[j])
               {
                   money += b[i];
                   j++;
                   i++;
               }
               else{i++;}

           }
           if (z)
           cout<<money<<endl;
       }
    }
   return 0;
}
 
 
 
 
 
 
 
 

转载于:https://www.cnblogs.com/T8023Y/p/3197402.html

内容概要:该研究通过在黑龙江省某示范村进行24小时实地测试,比较了燃煤炉具与自动/手动进料生物质炉具的污染物排放特征。结果显示,生物质炉具相比燃煤炉具显著降低了PM2.5、CO和SO2的排放(自动进料分别降低41.2%、54.3%、40.0%;手动进料降低35.3%、22.1%、20.0%),但NOx排放未降低甚至有所增加。研究还发现,经济性和便利性是影响生物质炉具推广的重要因素。该研究不仅提供了实际排放数据支持,还通过Python代码详细复现了排放特征比较、减排效果计算和结果可视化,进一步探讨了燃料性质、动态排放特征、碳平衡计算以及政策建议。 适合人群:从事环境科学研究的学者、政府环保部门工作人员、能源政策制定者、关注农村能源转型的社会人士。 使用场景及目标:①评估生物质炉具在农村地区的推广潜力;②为政策制定者提供科学依据,优化补贴政策;③帮助研究人员深入了解生物质炉具的排放特征和技术改进方向;④为企业研发更高效的生物质炉具提供参考。 其他说明:该研究通过大量数据分析和模拟,揭示了生物质炉具在实际应用中的优点和挑战,特别是NOx排放增加的问题。研究还提出了多项具体的技术改进方向和政策建议,如优化进料方式、提高热效率、建设本地颗粒厂等,为生物质炉具的广泛推广提供了可行路径。此外,研究还开发了一个智能政策建议生成系统,可以根据不同地区的特征定制化生成政策建议,为农村能源转型提供了有力支持。
我的电脑显卡是NVIDIA CUDA 11.6.114 driver,win10,64位的,在安装Anaconda时,有如下几个版本:Anaconda-1.4.0-Windows-x86_64.exe 241.4 MiB 2013-07-04 17:58 Anaconda-1.5.0-Linux-x86.sh 238.8 MiB 2013-07-04 18:10 Anaconda-1.5.0-Linux-x86_64.sh 306.7 MiB 2013-07-04 18:22 Anaconda-1.5.0-MacOSX-x86_64.sh 166.2 MiB 2013-07-04 18:37 Anaconda-1.5.0-Windows-x86.exe 236.0 MiB 2013-07-04 18:45 Anaconda-1.5.0-Windows-x86_64.exe 280.4 MiB 2013-07-04 18:57 Anaconda-1.5.1-MacOSX-x86_64.sh 166.2 MiB 2013-07-04 19:11 Anaconda-1.6.0-Linux-x86.sh 241.6 MiB 2013-07-04 19:19 Anaconda-1.6.0-Linux-x86_64.sh 309.5 MiB 2013-07-04 19:32 Anaconda-1.6.0-MacOSX-x86_64.sh 169.0 MiB 2013-07-04 19:47 Anaconda-1.6.0-Windows-x86.exe 244.9 MiB 2013-07-04 19:56 Anaconda-1.6.0-Windows-x86_64.exe 290.4 MiB 2013-07-04 20:09 Anaconda-1.6.1-Linux-x86.sh 247.1 MiB 2013-07-05 08:34 Anaconda-1.6.1-Linux-x86_64.sh 317.6 MiB 2013-07-05 09:20 Anaconda-1.6.1-MacOSX-x86_64.pkg 197.3 MiB 2013-07-05 10:05 Anaconda-1.6.1-MacOSX-x86_64.sh 170.0 MiB 2013-07-05 12:20 Anaconda-1.6.1-Windows-x86.exe 244.4 MiB 2013-07-05 12:29 Anaconda-1.6.1-Windows-x86_64.exe 289.9 MiB 2013-07-05 12:49 Anaconda-1.6.2-Windows-x86.exe 244.4 MiB 2013-07-10 06:19 Anaconda-1.6.2-Windows-x86_64.exe 289.9 MiB 2013-07-10 07:04 Anaconda-1.7.0-Linux-x86.sh 381.0 MiB 2013-09-20 01:04 Anaconda-1.7.0-Linux-x86_64.sh 452.6 MiB 2013-09-20 02:49 Anaconda-1.7.0-MacOSX-x86_64.pkg 256.7 MiB 2013-09-20 05:04 Anaconda-1.7.0-MacOSX-x86_64.sh 223.3 MiB 2013-09-20 11:00 Anaconda-1.7.0-Windows-x86.exe 280.6 MiB 2013-09-20 11:11 Anaconda-1.7.0-Windows-x86_64.exe,请问我应该安装哪一个?
07-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值