请好朋友解决这个问题 [英] Solve this question please my friends

查看:121
本文介绍了请好朋友解决这个问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为杰克得到了UOIT的早期报价,他喜出望外的父母给了他很多魔方作为奖励。然而,他很快就开发了腕管综合症,现在不得不以原价的一半出售他的一些立方体来支付医疗费用。

杰克是一个非常独特的人;他得到的N个立方体各有一个明显的值Vi,并且放在一条直线上。他想知道他是否总共至少有M美元,他将所有的立方体包含在Va值和Vb值之间(在线上)之间。他特别想以形式(Va,Vb)询问Q问题,以便在销售该范围内的所有立方体后知道他是否有足够的钱。两个多维数据集都保证存在于序列中。

注意:使用无符号的64位变量(例如C ++中的unsigned long long)可能会有所帮助。



约束

子任务1 [10%]

•1≤N,Q≤100

•1≤M, V≤1000



子任务2 [90%]

•1≤N,Q≤100000

• 1≤M≤10000000

•1≤V≤1000000



输入规格

第一行输入将由3个以空格分隔的整数N,M和Q组成。下一行将包含N个以空格分隔的整数,其中第i个整数表示Vith值。对于下一个Q行,每行将包含2个空格分隔的整数Va和Vb。



输出规格

对于每个问题,输出足够如果杰克可以负担他的账单或者不够,如果他不能。



样本输入



5 10 2

10 1 4 3 7

1 3

10 7



样本输出



不够

够了



我有什么尝试过:



我不是在寻找代码,但想知道是否有人可以解释问题的确切问题。我刚刚在48小时前开始编码,并意识到我并不真正理解某些网站上出现的问题的格式。



根据我的理解,我在一行中有几个立方体,每个立方体的值分别为V.每个立方体(或vi,vi + 1,vi + 2) ... vi + n)有货币价值。在VA到VB的子集中,其可以大到100(q <= 100),我按顺序添加它们。该subest采用一个值(比方说)R。然后我检查R的值是大于M还是小于M​​.如果它小于R,则比我循环回到开始并尝试使用不同的子集。如果R的值等于或大于M,那么我将计数器设置为1并重复整个循环,直到计数器的值等于Q.这是我理解但不确定这是否是它的要求,有人可以帮忙澄清吗?

Because Jake got an early offer from UOIT, his overjoyed parents gave him a lot of Rubik's Cubes as a reward. However, he soon developed Carpal Tunnel Syndrome, and now has to sell some of his cubes at half of their original price to pay for his medical bills.
Jake is a very unique person; the N cubes that he got each have a distinct value Vi, and are placed in a straight line. He wants to know if he has a total of at least M dollars after he sells all of his cubes inclusively between the one valued at Va and the one valued at Vb (in the line). He specifically wants to ask Q questions in the form (Va,Vb) to know if he has enough money after selling all of the cubes in that range. Both cubes are guaranteed to exist in the sequence.
Note: it may be helpful to use unsigned 64-bit variables (e.g. unsigned long long in C++).

Constraints
Subtask 1 [10%]
• 1≤N, Q≤100
• 1≤M, V≤1000

Subtask 2 [90%]
• 1≤N,Q≤100000
• 1≤M≤10000000
• 1≤V≤1000000

Input Specification
The first line of input will consist of 3 space-separated integers N, M, and Q. The next line will contain N space-separated integers, where the ith integer represents the Vith value. For the next Q lines, each line will contain 2 space separated integers Va and Vb.

Output Specification
For each question, output Enough if jake can afford his bills or Not enough if he cannot.

Sample Input

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

Sample Output

Not enough
Enough

What I have tried:

I'm not specefically looking for a code but wondering if someone can explain what the question is exactly asking. I just started coding about 48 hours ago, and realized I do not really understand the format of questions present on some website.

From what I can understand I have several cubes in a line, each with a respective value of V. Each cube (or vi, vi+1, vi+2... vi+n) has a money value. In subsets of VA to VB which can be as large as 100 (q<= 100) i add them sequentially. The subest procudes a value of (lets say) R. I then check the value of R to be either greater than M or less than M. If it is less than R, than I loop back to the begining and try with a different subset. If the value of R is equal to or greater than M, then i set the counter to 1 and repeatthe entire loop until the value of the counter is equal to Q. This is what I understand but not sure if this is what it is asking, can some one help to clarify?

推荐答案

对我来说问题很清楚:每个查询行都给你起始值 Va 和结束值 Vb 。您必须在值序列中找到 Va Vb ,然后将<$ c $之间的所有值相加包括c> Va 和 Vb 。如果这样的金额大于或等于 M 那么打印'足够'如果,另一方面,总和小于 M 然后打印'不够'。
To me the question is clear: each query line gives you the starting value Va and the end value Vb. You have to find both Va and Vb in the sequence of values and then sum all the values between Va and Vb included. If such sum is bigger than, or equal to, M then print 'enough' if, on the other end, the sum is less than M then print 'not enough'.


我们不做你的HomeWork。

HomeWork不会在乞求别人做你的工作时测试你的技能,它会让你思考并帮助你的老师检查你对你所学课程的理解以及你在申请时遇到的问题他们。

你的任何失败都会帮助你的老师发现你的弱点并设定补救措施。

所以,试一试,重读你的课程并开始工作。如果您遇到特定问题,请显示您的代码并解释这个问题,我们可能会提供帮助。



作为程序员,您的工作是创建算法解决特定问题,你不能依赖别人永远为你做,所以有一段时间你必须学会​​如何。而且越快越好。

当你要求解决方案时,就像试图通过培训其他人来学习开车一样。

创建算法基本上是找数学并做出必要的调整以适应你的实际问题。



[更新]

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work, it is set to make you think and to help your teacher to check your understanding of the courses you have taken and also the problems you have at applying them.
Any failure of you will help your teacher spot your weaknesses and set remedial actions.
So, give it a try, reread your lessons and start working. If you are stuck on a specific problem, show your code and explain this exact problem, we might help.

As programmer, your job is to create algorithms that solve specific problems and you can't rely on someone else to eternally do it for you, so there is a time where you will have to learn how to. And the sooner, the better.
When you just ask for the solution, it is like trying to learn to drive a car by having someone else training.
Creating an algorithm is basically finding the maths and make necessary adaptation to fit your actual problem.

[Update]
引用:

我不是在寻找代码,而是想知道是否有人可以解释问题的确切问题。我刚刚在48小时前开始编码,并意识到我并不真正理解某些网站上出现的问题的格式。

I'm not specefically looking for a code but wondering if someone can explain what the question is exactly asking. I just started coding about 48 hours ago, and realized I do not really understand the format of questions present on some website.



您是初学者。因此,不要试图解决互联网上的随机问题,其中一些是熟练的程序员,另一些是高级程序员的挑战。

建议:找到教程网站跟随他们,做练习,他们的难度是进步并匹配tutos的水平。


You are a beginner. so stop trying to solve random problems on internet, some of them are meant for skilled programmers, other are challenges for advanced programmers.
Advice: Find tutorial sites follow them, do the exercises, their difficulty is progressive and match the level of tutos.


Nope,nope,nope。我们不是来为你做功课。



为什么?因为下一个任务将建立在这一个上。如果我们为你做这件事,你就什么都不学,让自己更加落后,最终失败了。
Nope, nope, nope. We are not here to do your homework for you.

Why? Because the next assignment will build on this one. If we do it for you you learn absolutely nothing, putting yourself even farther behind and eventually failing the class.


这篇关于请好朋友解决这个问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆