[ Outline ] · Standard · Linear+

> Zanimljivi Zadaci

ex-paydoman
post Sep 14 2006, 09:30 PM
Post #1


Moderator


Group: Članovi
Joined: 21-February 06
Member No.: 23
Status: Učenik MGa



1. zadatak:

u gradu a zziwi berberin koji brije one i samo one stanownike toga grada koji ne briju sami sebe. gde se nalazi grad a?

2. zadatak:

da li je istina da ako prodjete kroz dugu promenite pol?


zadao nam je prof. analize, prof. dr Ninoslaw Tjiritj

pa, reshawajte tongue.gif


--------------------
ode..
User is offlineProfile CardPM
Go to the top of the page
+Quote Post
 
Reply to this topicStart new topicStart Poll
Replies
pyost
post Feb 9 2007, 10:33 PM
Post #2


Deus Ex Makina
Group Icon

Group: Administratori
Joined: 25-January 06
From: Beograd
Member No.: 2
Status: Bivši učenik MGa
Škola/Razred: RAF



Ja sam to resio na drugaciji, malo neefikasniji nacin laugh.gif

CODE
program queen;

type
   tabla = array [1..8,1..8] of integer;

var
  a:tabla;
  i,j,p:integer;
  skup: set of 1..8;


function moze(i,j:integer;t:tabla):boolean;
var
  x,y:integer;
  help:boolean;
begin
    help:=true;

    for x:=1 to 8 do
        for y:=1 to 8 do
            if ((x=i) or (y=j) or (x-y=i-j) or (x+y=i+j)) and (t[x,y]=1) and not ((x=i) and (y=j))
                  then help:=false;

    moze:=help;
end;

function proveri:boolean;
var
  i,j:integer;
  help:boolean;
begin
    help:=true;

    for i:=1 to 8 do
        for j:= 1 to 8 do
            if a[i,j]=1 then if not moze(i,j,a) then help:=false;

    proveri:=help;
end;


begin

    randomize;

    p:=1;

    while p<100000 do
    begin

         for i:=1 to 8 do
             for j:=1 to 8 do
                a[i,j]:=0;

         skup:=[];

         for i:=1 to 8 do
         begin

              repeat
                    j:=random(8)+1;
              until not (j in skup);

              skup:=skup+[j];

              a[i,j]:=1;

         end;

         if proveri then
         begin
                 for i:=1 to 8 do
                 begin
                      for j:=1 to 8 do
                          write(a[i,j],' ');
                      writeln;
                 end;
                 writeln;
         end;

         p:=p+1;

    end;

    writeln('Kraj');
end.


Ovaj program proverava za 100000 random kobinacija, a neke se pri ispisu i ponavljaju.


--------------------
Baby, it's a violent world.

Registrovani korisnik Linuxa broj 460770 [Ubuntu 7.10]
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic
ex-paydoman   Zanimljivi Zadaci   Sep 14 2006, 09:30 PM
pyost   RE: Zanimljivi Zadaci   Sep 14 2006, 09:33 PM
ex-paydoman   RE: Zanimljivi Zadaci   Sep 14 2006, 09:36 PM
pyost   RE: Zanimljivi Zadaci   Sep 14 2006, 09:37 PM
Eli0t   RE: Zanimljivi Zadaci   Sep 14 2006, 09:40 PM
jeele   RE: Zanimljivi Zadaci   Sep 16 2006, 07:26 AM
ex-paydoman   RE: Zanimljivi Zadaci   Sep 14 2006, 09:44 PM
pyost   RE: Zanimljivi Zadaci   Sep 14 2006, 09:56 PM
ex-paydoman   RE: Zanimljivi Zadaci   Sep 14 2006, 10:04 PM
^_NiN0_^   RE: Zanimljivi Zadaci   Sep 15 2006, 12:26 AM
Neonkitza   RE: Zanimljivi Zadaci   Sep 14 2006, 10:06 PM
RZA   RE: Zanimljivi Zadaci   Sep 14 2006, 10:07 PM
ex-paydoman   RE: Zanimljivi Zadaci   Sep 14 2006, 10:13 PM
RZA   RE: Zanimljivi Zadaci   Sep 14 2006, 10:15 PM
ex-paydoman   RE: Zanimljivi Zadaci   Sep 15 2006, 08:51 AM
Eli0t   RE: Zanimljivi Zadaci   Sep 15 2006, 10:16 AM
ex-paydoman   RE: Zanimljivi Zadaci   Sep 15 2006, 10:17 AM
Puzzler   RE: Zanimljivi Zadaci   Sep 15 2006, 09:36 PM
RZA   RE: Zanimljivi Zadaci   Sep 15 2006, 09:36 PM
maxydelanoche   RE: Zanimljivi Zadaci   Sep 15 2006, 09:47 PM
RZA   RE: Zanimljivi Zadaci   Sep 15 2006, 09:56 PM
aphr0   RE: Zanimljivi Zadaci   Sep 21 2006, 12:40 AM
pyost   RE: Zanimljivi Zadaci   Sep 21 2006, 02:31 PM
RZA   RE: Zanimljivi Zadaci   Sep 21 2006, 10:38 PM
Neonkitza   RE: Zanimljivi Zadaci   Sep 21 2006, 07:08 PM
^_NiN0_^   RE: Zanimljivi Zadaci   Sep 22 2006, 10:25 AM
RZA   RE: Zanimljivi Zadaci   Sep 22 2006, 11:08 AM
^_NiN0_^   RE: Zanimljivi Zadaci   Sep 22 2006, 11:41 AM
pyost   RE: Zanimljivi Zadaci   Sep 22 2006, 01:31 PM
^_NiN0_^   RE: Zanimljivi Zadaci   Sep 22 2006, 01:41 PM
Puzzler   RE: Zanimljivi Zadaci   Sep 22 2006, 07:38 PM
pyost   RE: Zanimljivi Zadaci   Sep 22 2006, 08:52 PM
RZA   RE: Zanimljivi Zadaci   Sep 22 2006, 10:08 PM
pyost   RE: Zanimljivi Zadaci   Sep 22 2006, 10:17 PM
RZA   RE: Zanimljivi Zadaci   Sep 22 2006, 10:18 PM
Eli0t   RE: Zanimljivi Zadaci   Sep 22 2006, 10:37 PM
RZA   RE: Zanimljivi Zadaci   Sep 22 2006, 10:45 PM
^_NiN0_^   RE: Zanimljivi Zadaci   Sep 23 2006, 11:33 AM
RZA   RE: Zanimljivi Zadaci   Sep 23 2006, 02:40 PM
Eli0t   RE: Zanimljivi Zadaci   Sep 23 2006, 02:43 PM
RZA   RE: Zanimljivi Zadaci   Sep 23 2006, 02:51 PM
Eli0t   RE: Zanimljivi Zadaci   Sep 23 2006, 03:04 PM
RZA   RE: Zanimljivi Zadaci   Sep 23 2006, 03:06 PM
Eli0t   RE: Zanimljivi Zadaci   Sep 23 2006, 03:09 PM
RZA   RE: Zanimljivi Zadaci   Sep 23 2006, 03:11 PM
Eli0t   RE: Zanimljivi Zadaci   Sep 23 2006, 03:14 PM
RZA   RE: Zanimljivi Zadaci   Sep 23 2006, 03:17 PM
Eli0t   RE: Zanimljivi Zadaci   Sep 23 2006, 03:21 PM
RZA   RE: Zanimljivi Zadaci   Sep 23 2006, 03:25 PM
Eli0t   RE: Zanimljivi Zadaci   Sep 23 2006, 03:28 PM
^_NiN0_^   RE: Zanimljivi Zadaci   Sep 23 2006, 06:09 PM
Eli0t   RE: Zanimljivi Zadaci   Sep 24 2006, 12:36 AM
pyost   RE: Zanimljivi Zadaci   Sep 24 2006, 09:51 AM
RZA   RE: Zanimljivi Zadaci   Sep 24 2006, 10:24 AM
^_NiN0_^   RE: Zanimljivi Zadaci   Sep 24 2006, 10:25 AM
Eli0t   RE: Zanimljivi Zadaci   Sep 24 2006, 11:48 AM
Puzzler   RE: Zanimljivi Zadaci   Feb 8 2007, 05:43 PM
pyost   RE: Zanimljivi Zadaci   Feb 8 2007, 05:47 PM
Eli0t   RE: Zanimljivi Zadaci   Feb 8 2007, 05:59 PM
^_NiN0_^   RE: Zanimljivi Zadaci   Feb 9 2007, 04:42 PM
Anchi   RE: Zanimljivi Zadaci   Feb 9 2007, 08:23 PM
^_NiN0_^   RE: Zanimljivi Zadaci   Feb 9 2007, 08:42 PM
Puzzler   RE: Zanimljivi Zadaci   Feb 9 2007, 09:43 PM
pyost   RE: Zanimljivi Zadaci   Feb 9 2007, 09:49 PM
Puzzler   RE: Zanimljivi Zadaci   Feb 9 2007, 09:59 PM
pyost   RE: Zanimljivi Zadaci   Feb 9 2007, 10:17 PM
Anchi   RE: Zanimljivi Zadaci   Feb 9 2007, 10:20 PM
Puzzler   RE: Zanimljivi Zadaci   Feb 9 2007, 10:26 PM
pyost   RE: Zanimljivi Zadaci   Feb 9 2007, 10:33 PM
^_NiN0_^   RE: Zanimljivi Zadaci   Feb 10 2007, 12:48 AM
LoshMeeBre   RE: Zanimljivi Zadaci   Feb 11 2007, 11:01 PM
Puzzler   RE: Zanimljivi Zadaci   Feb 9 2007, 10:35 PM
pyost   RE: Zanimljivi Zadaci   Feb 9 2007, 10:36 PM
Puzzler   RE: Zanimljivi Zadaci   Feb 9 2007, 10:44 PM
pyost   RE: Zanimljivi Zadaci   Feb 9 2007, 11:00 PM
jeele   RE: Zanimljivi Zadaci   Feb 10 2007, 11:49 AM
jeele   RE: Zanimljivi Zadaci   Feb 10 2007, 11:53 AM
pyost   RE: Zanimljivi Zadaci   Feb 10 2007, 11:54 AM
jeele   RE: Zanimljivi Zadaci   Feb 10 2007, 12:38 PM
Eli0t   RE: Zanimljivi Zadaci   Feb 11 2007, 10:42 PM
pyost   RE: Zanimljivi Zadaci   Feb 11 2007, 10:47 PM
Eli0t   RE: Zanimljivi Zadaci   Feb 11 2007, 10:49 PM
pyost   RE: Zanimljivi Zadaci   Feb 11 2007, 11:03 PM
traja   RE: Zanimljivi Zadaci   Mar 2 2007, 03:49 PM
pyost   RE: Zanimljivi Zadaci   May 2 2007, 09:32 PM
Eli0t   RE: Zanimljivi Zadaci   May 2 2007, 09:56 PM
pyost   RE: Zanimljivi Zadaci   May 2 2007, 10:02 PM
Eli0t   RE: Zanimljivi Zadaci   May 2 2007, 10:05 PM
pyost   RE: Zanimljivi Zadaci   May 2 2007, 10:11 PM
maxydelanoche   RE: Zanimljivi Zadaci   May 3 2007, 01:57 AM
pyost   RE: Zanimljivi Zadaci   May 3 2007, 10:42 AM
Pera Detlic   RE: Zanimljivi Zadaci   May 3 2007, 10:26 PM
Eli0t   RE: Zanimljivi Zadaci   May 3 2007, 10:41 PM
Anchi   RE: Zanimljivi Zadaci   May 3 2007, 11:09 PM
maxydelanoche   RE: Zanimljivi Zadaci   May 4 2007, 09:30 AM
pyost   RE: Zanimljivi Zadaci   May 4 2007, 11:28 AM
maxydelanoche   RE: Zanimljivi Zadaci   May 4 2007, 02:39 PM
^_NiN0_^   RE: Zanimljivi Zadaci   May 4 2007, 06:01 PM
pyost   RE: Zanimljivi Zadaci   May 4 2007, 06:17 PM
^_NiN0_^   RE: Zanimljivi Zadaci   May 4 2007, 06:50 PM
2 Pages  1 2 >


Reply to this topicTopic OptionsStart new topic
11 User(s) are reading this topic (11 Guests and 0 Anonymous Users)
0 Members: