House Lawn

本文探讨了如何选择最适合的机器人割草机,通过计算不同割草机的效率和成本,帮助用户找到既能满足割草需求又经济实惠的选项。

House Lawn

Description

You have just bought a new house, and it has a huge, beautiful lawn. A lawn that needs cutting. Several times. Every week. The whole summer.

After pushing the lawnmower around the lawn during the hottest Saturday afternoon in history, you decided that there must be a better way. And then you saw the ads for the new robotic lawnmovers. But which one should you buy? They all have different cutting speeds, cutting times and recharge times, not to mention different prices!

According to the advertisement, a robotic lawnmover will spend all its time either cutting the lawn or recharging its battery. Starting from a full battery, it will cut the lawn at a given rate of c square meters per minute for a cutting time of t minutes, after which it has run out of battery. Once out of battery, it will immediately start recharging. After recharging for r minutes the battery is full again and it immediately starts cutting.

You decide that in order for your lawn to look sufficiently prim and proper, the lawnmower that you buy must be powerful enough to cut your whole lawn at least once a week on average. Formally, if we start the mower fully charged at the beginning of the week and run it for exactly T weeks, it needs to cut the whole lawn at least T times, for all positive integers T. But apart from this, you have no specific requirements, so among the ones that satisfy this requirement, you will simply go for the cheapest option. For the purposes of cutting your lawn, you may make the simplifying assumption that a week is always exactly 10 080 minutes long.

Input

The first line of input contains two integers ℓ and m (1 ≤ ℓ ≤ 106, 1 ≤ m ≤ 100), the size of your lawn in square meters, and the number of lawnmowers to consider, respectively.

Then follow m lines, each containing a string n and 4 integers p, c, t, and r, separated by commas, describing a lawnmower as follows:

  • n is the name of the lawnmower, a string of at most 60 printable characters (ASCII 32 to 126) excluding ‘,’, neither starting nor ending with a space,
  • 1 ≤ p ≤ 100 000 is the price of the lawnmover,
  • 1 ≤ c ≤ 100 is the cutting rate in square meters per minute,
  • 1 ≤ t ≤ 10 080 is the cutting time in minutes, and
  • 1 ≤ r ≤ 10 080 is the recharge time in minutes.

Output

Output the name of the cheapest lawnmower capable of cutting your whole yard at least once a week on average. If several lawnmovers share the same lowest price, output all of their names, in the same order they were given in the input. If there is no such mower, output “no such mower”.

Sample Input

7000 4
Grass Slayer 2000,9999,10,120,120
Slow-Mowe,999,1,120,240
Eco-cut X2,5499,2,25,35
Mowepower,5499,3,25,35
------------------------------------------
100000 4
Grass Slayer 2000,9999,10,120,120
Slow-Mowe,999,1,120,240
Eco-cut X2,5499,2,25,35
Mowepower,5499,3,25,35

Sample Output

Eco-cut X2
Mowepower
-----------------------------------
no such mower

题意:给你n个机器人,每个机器人有价格p,速度v,满电行走时间t和充满电所需时间r,从满足条件的机器人中选取价格最少的机器人,条件:有长为len的路,对于任意周数T,机器人都要能走T遍

思路:计算出机器人走一遍所需的时间need(包括充电时间,如果只用了部分电量,算上冲这一部分电量所需时间),当need>10080时肯定存在T= l c m ( t + r , 10080 ) lcm(t+r,10080) lcm(t+r,10080)/10080使得走完这么多周后刚好充满电,而lcm/need < T,不符合条件,当need <= 10080时,第T周T*10080/need >= T,而且因为计算need时算上了以后充电的时间,一开始是满电,等于说实际上T周中平均每圈所用时间<=need(因为可能T周后还有电量剩余,或者是充电中,等于说预支了充电时间,实际不要那么多时间)

代码:

#include<bits/stdc++.h>
using namespace std;
struct node
{
	string s;
	int p;
	double need;
}nod[105];
int len,n;
int main()
{
	while(~scanf("%d%d",&len,&n))
	{
		string s;
		int cnt,p,v,t,r,minn = 1000000000;
		char c;
		getchar();
		for(int i = 1;i <= n;++i)
		{
			s = "";
			c = getchar();
			p = v = t = r = cnt = 0;
			while(c != '\n')
			{
				if(c == ',')
					++cnt;
				else if(cnt == 0)
					s += c;
				else if(cnt == 1)
					p = p * 10 + c - '0';
				else if(cnt == 2)
					v = v * 10 + c - '0';
				else if(cnt == 3)
					t = t * 10 + c - '0';
				else
					r = r * 10 + c - '0';
				c = getchar();
			}
			int dis = v * t;
			double need = len / dis * (t+r) + len % dis * 1.0 /dis*(r+t);
			nod[i].need = need,nod[i].s = s,nod[i].p = p;
			if(need <= 10080)
				minn = min(minn,p);
		}
		if(minn == 1000000000)
			printf("no such mower\n");
		for(int i = 1;i <= n;++i)
		{
			if(nod[i].p == minn && nod[i].need <= 10080)
				cout << nod[i].s << endl;
		}
	}
	return 0;
}
帮我写一个脚本,我现在在 (base) root@dev-kunlin-yang-aieditor-test-je93-849d767db7-pr72x:/common-data/kunlin/code/ReCamMaster-main# ls /common-data/kunlin/code/ReCamMaster-main/split_metadata/ metadata_1.csv metadata_2.csv metadata_4.csv metadata_6.csv metadata_8.csv metadata_10.csv metadata_3.csv metadata_5.csv metadata_7.csv metadata_9.csv 其中每一个csv是:file_name text 001_lgFzrIujya8_13_19to172.mp4 The video features a woman named Terri Thomas, who is 50 years old and a Fancidancer. She is wearing a pink headband with a pink ribbon design, a pink shirt, and a gold necklace. The video is shot in a room with a clock on the wall. The style of the video is a close-up interview, with Terri speaking directly to the camera. The focus is on her face and upper body, and the room provides a simple, uncluttered background. The lighting is bright and even, highlighting Terri's features and the colors of her clothing. The overall impression is of a confident and articulate individual sharing her story. 004_Hxc1AXTUzA4_11_0to111.mp4 In the video, a man in a green shirt is standing in a kitchen, gesturing with his hands as he speaks. He is pointing towards a wooden cutting board on a counter. The kitchen is well-equipped with various appliances and items, including a refrigerator, an oven, and several potted plants. There are also bowls and a bottle on the counter. The man appears to be explaining something, possibly related to cooking or food preparation, as he is in a kitchen setting. The overall style of the video seems to be informative or instructional, with the man providing guidance or commentary on the scene. 005_CQsjrgfCF9I_8_0to145.mp4 The video features a man standing amidst a lush garden filled with various potted plants. The man, dressed in a plaid shirt, is positioned in the center of the frame, surrounded by greenery. He appears to be speaking or presenting, as suggested by the text overlay on the video. The text, which reads "Let the soil dry between waterings", is likely providing gardening advice or tips. The overall style of the video seems to be informative, possibly aimed at gardening enthusiasts or those interested in plant care. The setting, with its abundance of plants, creates a serene and natural atmosphere, further emphasizing the gardening theme. 006_bpfqYgCvutY_38_0to147.mp4 In the video, a man and a woman are engaged in a conversation in a fresh produce market. The man, dressed in a pink shirt, is leaning over a barrel filled with fresh fruits and vegetables. The woman, wearing a black shirt, stands across from him, attentively listening to his words. The market is well-stocked with various fruits and vegetables, including apples, oranges, and bananas, all displayed in wooden barrels. A shopping cart is also visible in the scene, suggesting that the man and woman might be customers. The overall atmosphere of the video is lively and colorful, reflecting the abundance of fresh produce in the market. 008_LiBGM38mwh4_0_0to106.mp4 The video shows a small, rustic hut with a thatched roof, situated in a grassy field. The hut is adorned with an abundance of pumpkins and gourds, arranged in a decorative manner around the entrance and sides of the structure. The pumpkins and gourds vary in size and color, creating a vibrant and festive display. The hut is surrounded by a lush green lawn, and in the background, there are trees and a house. The overall style of the video is whimsical and seasonal, capturing the essence of a fall harvest celebration. 我希望你能够按照这里filename去/common-data/kunlin/code/ReCamMaster-main/selected_videos/拿对应的视频组成文件夹test_videoX, metadata1就是test_video1,等等,同时将视频放在test_videoX下面的videos,将metadata放在test_videoX下面,再将"/common-data/kunlin/code/ReCamMaster-main/example_test_data/cameras/" 复制到每个test_video下面
09-25
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值