[Logo] Mendo Judge Discussion Board - Forums
  [Search] Search   [Recent Topics] Recent Topics   [Hottest Topics] Hottest Topics   [Members]  Member Listing   [Groups] Back to home page 
Некој да ми го објасни овој алгоритам !!!  XML
Forum Index » Други задачи
Author Message
Perez



Joined: 18/10/2014 18:53:59
Messages: 93
Offline

Ова е задачата
http://codeforces.com/contest/670/problem/B
Туторијалот вака вели:
To solve this problem we need to brute how many identifiers will called robots in the order from left to right. Let's solve this problem in one indexing. Let the current robot will call i identifiers. If k - i > 0 let's make k = k - i and go to the next robot. Else we need to print a[k], where a is the array with robots identifiers and end our algorithm.
Perez



Joined: 18/10/2014 18:53:59
Messages: 93
Offline

REFRESH
MOI



Joined: 07/07/2010 16:31:48
Messages: 447
Offline

Perez wrote:Туторијалот вака вели:
To solve this problem we need to brute how many identifiers will called robots in the order from left to right. Let's solve this problem in one indexing. Let the current robot will call i identifiers. If k - i > 0 let's make k = k - i and go to the next robot. Else we need to print a[k], where a is the array with robots identifiers and end our algorithm.

Не е баш најдобро објаснето таму, но поентата е едноставна: i-тиот робот ќе каже точно i идентификатори. Првиот ќе каже 1 (само неговиот), вториот ќе каже 2 (на првиот робот, и неговиот), третиот ќе каже 3, итн... Сега, може или да го намапиш k како што е пишано таму, или (што мислам дека е полесно да се разбере) да имаш некој бројач кој што ќе брои колку идентификатори се кажани до тој момент. Нешто вака:

This message was edited 1 time. Last update was at 03/09/2017 16:39:04

Perez



Joined: 18/10/2014 18:53:59
Messages: 93
Offline

Mhm е , како би ми текнало мене вака да ја решам јас одев со бројач додека не се постигне k ... ama vaka e mnogu poefikasno .
Perez



Joined: 18/10/2014 18:53:59
Messages: 93
Offline

Благодарам многу
 
Forum Index » Други задачи
Go to:   
Powered by JForum 2.1.8 © JForum Team