Chào mừng bạn đã đến với Cộng đồng LuyenDich.com

Để chung tay phát triển Luyendich.com

Các bạn hay chia sẻ và giới thiệu đến bạn bè trên các Forum, Facebook hay qua các kênh khác nhe

Share this question

462 questions

1,180 answers

259 comments

1,920 users


Dịch Anh Việt

Dịch Việt Anh

Viết Luận

Hỏi đáp chung

Hỏi đáp ngữ pháp

Kiến Thức Tiếng Anh

Chia sẻ kinh nghiệm

Học Từ Vựng

Tài liệu Tiếng Anh


NHẬN BÀI QUA EMAIL

Nhập địa chỉ Email:


Sau khi đăng ký, hãy mở Email để kích hoạt



Delivered by FeedBurner

các anh dịch hộ em đoạn tiếng anh này với

0 votes

 

Problem Statement 6: Corleone’s gangwars

(400 points)

"When you want something, all the universe conspires in helping you achieve it."

Langdon got help from Santiago in completing his mission of cracking the code to the secure vault. Thereafter, he had to meet up with Sophie Neveu in NYC and left Santiago at Long Island. It was here that Santiago heard of the story of Don Vito Corleone – the resplendent mafia who had landed on Long Island with nothing but dreams. Santiago, being a big dreamer himself, couldn’t wait to meet the man.

When he finally got a chance, Vito Corleone’s fortunes were sagging as a rival mafia was on the ascendancy. Looking for all the help he could muster, Vito Corleone asked Santiago to help him out in strategising a gang war. Vito needs to figure out the minimum distance that each of his men need to travel in order to get to a nearest friendly area.

Given a map, in the form of a square matrix containing 0’s and 1’s (0’s representing Corleone’s enemy grids and 1’s Corleone’s friendly grids), the task is to figure out the distance of the closest Corleone’s friendly grid for each grid. The distance between grids (i,j) and (x,y) is defined by

(i-x)*(i-x) + (j-y)*(j-y)

Input: The first line contains the number of test cases.

For each test case, the first line specifies the dimension of the square grid, N. This is followed by n lines, each containing n integers (0’s or 1’s), separated by white spaces.

N <= 1000

Output: For each test case, generate an nxn matrix printed over n rows and each row containing n integers. The (i,j) entry of this output matrix is the minimum distance of a friendly grid from that point.

asked Aug 11, 2012 in Dịch Anh-Việt by trung (420 points)
Nếu thấy hay thì vui lòng click Like nhé:   

Please log in or register to answer this question.

Related questions

Luyện dịch | Dịch Anh Việt| Dịch Việt Anh | Bí quyết dịch | Tài liệu dịch| Học Dịch | | Tài liệu dịch| Hoc Tieng Anh |Hoc Tieng Anh truc tuyen |