我怎么做这个问题告诉我 [英] How do I DO this question tell me

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

问题描述

Sam是符合条件的单身汉。他决定安定下来,开始一个家庭。他去寻找新娘。



他想娶一个女孩,她至少有以下8种品质中的一种: -



1)女孩应该富有。



2)女孩应该是工程师/医生。



3)这个女孩应该漂亮。



4)女孩的身高应该是5.3。



5)女孩应该在跨国公司工作。



6)女孩应该是外向的。



7)女孩不应戴眼镜。



8)女孩应该善良诚实。



他正在寻找具有上述一些或所有8种品质的新娘。在新娘狩猎时,他可能会发现不止一个竞争者是他的妻子。



在这种情况下,他想选择一个房子离他家最近的女孩。为Sam找一个具有最高品质的新娘。如果有的话,有多个竞争者是在相同的距离来自山姆家的电子邮件;然后



打印不允许一夫多妻。



如果没有合适的女孩谁符合条件然后打印找不到合适的女孩



鉴于Matrix N * M,Sam的房子位于(1,1)。它由1表示。在同一矩阵中,可结婚女孩的位置也用1表示。因此,位置(1,1)的1不应被视为可结婚女孩所在位置。



根据Sam的标准,那个女孩的品质必须从她拥有的非零邻居(最多8个方向)的数量中解码出来。与上述条件类似,位置(1,1)处的1不应被视为女孩的品质。参见示例部分以便更好地理解。



找到Sam,一个合适的新娘并打印出新娘的行和列,并找出其中的品质数量。新娘拥有。



注意: - 距离按任意方向的跳数计算,即(左,右,上,下和对角线)



限制条件

2< = N,M< = 10 ^ 2



输入格式

第一行包含房屋的行(N)和列(M)。



接下来N行包含有关女孩的数据和他们的品质。



输出

它将包含新娘的行和列,以及新娘所拥有的品质数量冒号(即:)。





说明

示例1



输入:



2 9



1 0 1 1 0 1 1 1 1



0 0 0 1 0 1 0 0 1



输出:



1:7:3



说明:



女孩和品质出现在(1,3),(1,4),(1,6),(1,7),(1,8),(1,9), (2,4),(2,6),(2,9)。



出席(1,3)的女孩有2个品质(即(1,4)和(2,4))。



出席(1,4)的女孩有两种品质。



出席(1,6)的新娘有2个品质。



出席(1,7)的新娘有3个品质。



出席(1,8)的新娘有3种品质。



新娘出席( 1,9)有两种品质。



出席(2,4)的新娘有两种品质。



出席(2,6)的新娘有两种品质。



出席(2,9)的新娘有两种品质。



我们看到,有两个竞争者拥有最高质量,一个是(1,7),另一个是(1,8)。



离Sam家最近的女孩是(1,7)。因此,她是新娘。



因此,输出将是1:7:3。



示例2



输入:



6 6


1 0 0 0 0 0



0 0 0 0 0



0 0 1 1 1 0



0 0 1 1 1 0



0 0 1 1 1 0 < br $>


0 0 0 0 0



输出:



4:4:8



说明:



新娘和品质存在在(3,3),(3,4),(3,5),(4,3),(4,4),(4,5),(5,3),(5,4),( 5,5)



出席(3,3)的新娘有3个品质(即(3,4),(4,3)和(4,4) )。



出席(3,4)的新娘有5种品质。



新娘目前在(3,5)有3个品质。



出席(4,3)的新娘有5个品质。



出席(4,4)的新娘有8种品质。



新娘出席(4,5)有5个品质。



出席(5,3)的新娘有3个品质。



出席(5,4)的新娘有5种品质。



出席(5,5)的新娘有3种品质。



如我们所见,(4,4)中的女孩拥有最多的素质。因此,她是新娘。



因此,输出将是4:4:8。



我尝试了什么:



i已经尝试但无法得到这个..

Sam is an eligible bachelor. He decides to settle down in life and start a family. He goes bride hunting.

He wants to marry a girl who has at least one of the 8 qualities mentioned below:-

1) The girl should be rich.

2) The girl should be an Engineer/Doctor.

3) The girl should be beautiful.

4) The girl should be of height 5.3".

5) The girl should be working in an MNC.

6) The girl should be extrovert.

7) The girl should not have spectacles.

8) The girl should be kind and honest.

He is in search of a bride who has some or all the 8 qualities mentioned above. On bride hunting, he may find more than one contenders to be his wife.

In that case, he wants to choose a girl whose house is closest to his house. Find a bride for Sam who has maximum qualities. If in case, there are more than one contenders who are at equal distance from Sam’'s house; then

print ""Polygamy not allowed"".

In case there is no suitable girl who fits the criteria then print ""No suitable girl found""

Given a Matrix N*M, Sam's house is at (1, 1). It is denoted by 1. In the same matrix, the location of a marriageable Girl is also denoted by 1. Hence 1 at location (1, 1) should not be considered as location of a marriageable Girl’s location.

The qualities of that girl, as per Sam’'s criteria, have to be decoded from the number of non-zero neighbours (max 8-way) she has. Similar to condition above, 1 at location (1, 1) should not be considered as the quality of a Girl. See Example section to get a better understanding.

Find Sam, a suitable Bride and print the row and column of the bride, and find out the number of qualities that the Bride possesses.

NOTE: - Distance is calculated in number of hops in any direction i.e. (Left, Right, Up, Down and Diagonal)

Constraints
2 <= N,M <= 10^2

Input Format
First Line contains the row (N) and column (M) of the houses.

Next N lines contain the data about girls and their qualities.

Output
It will contain the row and column of the bride, and the number of qualities that Bride possess separated by a colon (i.e. :).


Explanation
Example 1

Input:

2 9

1 0 1 1 0 1 1 1 1

0 0 0 1 0 1 0 0 1

Output:

1:7:3

Explanation:

The girl and qualities are present at (1,3),(1,4),(1,6),(1,7),(1,8),(1,9),(2,4),(2,6),(2,9).

The girl present at (1,3) has 2 qualities (i.e. (1,4)and (2,4)).

The girl present at (1,4) has 2 qualities.

The Bride present at (1,6) has 2 qualities.

The Bride present at (1,7) has 3 qualities.

The Bride present at (1,8) has 3 qualities.

The Bride present at (1,9) has 2 qualities.

The Bride present at (2,4) has 2 qualities.

The Bride present at (2,6) has 2 qualities.

The Bride present at (2,9) has 2 qualities.

As we see, there are two contenders who have maximum qualities, one is at (1,7) and another at (1,8).

The girl who is closest to Sam's house is at (1,7). Hence, she is the bride.

Hence, the output will be 1:7:3.

Example 2

Input:

6 6

1 0 0 0 0 0

0 0 0 0 0 0

0 0 1 1 1 0

0 0 1 1 1 0

0 0 1 1 1 0

0 0 0 0 0 0

Output:

4:4:8

Explanation:

The bride and qualities are present at (3,3),(3,4),(3,5),(4,3),(4,4),(4,5),(5,3),(5,4),(5,5)

The Bride present at (3,3) has 3 qualities (i.e. (3,4),(4,3) and (4,4)).

The Bride present at (3,4) has 5 qualities.

The Bride present at (3,5) has 3 qualities.

The Bride present at (4,3) has 5 qualities.

The Bride present at (4,4) has 8 qualities.

The Bride present at (4,5) has 5 qualities.

The Bride present at (5,3) has 3 qualities.

The Bride present at (5,4) has 5 qualities.

The Bride present at (5,5) has 3 qualities.

As we see, the girl present in (4,4) has maximum number of Qualities. Hence, she is the bride.

Hence, the output will be 4:4:8.

What I have tried:

i have tried but unable to get this ..

推荐答案

我们不做你的作业:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!



如果遇到具体问题,请询问相关问题,我们会尽力提供帮助。但我们不打算为你做这一切!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!


你忘了:

You forgot:
9) The girl should be blond with big breasts



不,说真的,这是你对你的挑战,所有的兴趣都是你自己解决它,它是挑战你的技能。你获得的唯一知识是你需要提高你的技能。



我们不做你的家庭作业。

HomeWork未设置为在乞求其他人做你的工作时测试你的技能。

你的任何失败都会帮助你学习哪些有效,哪些无效,它被称为'试错'学习。

所以,试一试。如果您遇到特定问题,请显示您的代码并解释这个问题,我们可能会提供帮助。



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

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

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


No, seriously, this is a challenge by you to you, all the interest is that you solve it by yourself, it is to challenge your skills. The only knowledge you get is that you need to improve your skills.

We do not do your HomeWork.
HomeWork is not set to test your skills at begging other people to do your work.
Any failure of you will help you to learn what works and what don't, it is called 'trial and error' learning.
So, give it a try. 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.


这篇关于我怎么做这个问题告诉我的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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