Jump to content
Sign in to follow this  
Stefan

Nelamurire matrice stea stralucitoare

Recommended Posts

Salut, am matricea urmatoare, si cerinta: "Numim stea stralucitoare o stea care are intensitatea luminoasa mai mare decat a tuturor stelelor invecinate direct cu ea, pe orizontala, verticala sau diagonala."

6 8
1 8 5 7 1 6 3 4
1 2 3 1 1 5 2 1
1 7 1 9 1 1 8 1
6 3 5 1 6 4 3 1
1 9 5 7 1 8 2 1
1 5 6 5 3 1 3 6

O idee cum as putea incepe? Daca nu ati inteles http://varena.ro/problema/patrat, scuzati exprimarea :))

Share this post


Link to post
Share on other sites

parcurgi matricea (ai 2 for-uri pentru asta..).

 

Dupaia pentru fiecare element verifici valoarea vecinilor. De exemplu pentru punctul a[j], vecinu din dreapta e a[i-1][j], vecinu din dreapta sus e a[i-1][j-1], vecinu de jps e a[j+1] si tot asa.


love is a verb
Love is a doing word

Share this post


Link to post
Share on other sites

Cineva pare ca mia editat postu... nu cred ca am scris asa ca pare gresit :)) In fine, vezi tu cu indexu ce si cum trebuie, dar probabil ai prims idea :P


love is a verb
Love is a doing word

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...