ΠΡΟΓΡΑΜΜΑ γιαννακης ΜΕΤΑΒΛΗΤΕΣ ΑΚΕΡΑΙΕΣ: i, sthlh, j, grammh, st[8], N, temp, perites, arties, prwth_artia, prwth_perith ΛΟΓΙΚΕΣ: perith_found, artia_found ΑΡΧΗ ΓΡΑΨΕ "giannh dwse moy th grammh pou epilexate na sou pw poy tha valeis to pioni sou" ΔΙΑΒΑΣΕ i ΑΝ i mod 2 = 0 ΤΟΤΕ sthlh <- 1 ΑΛΛΙΩΣ sthlh <- 2 ΤΕΛΟΣ_ΑΝ ΓΡΑΨΕ "prepei na valeis to pioni sou sth thesh ", i, ",", sthlh !!!apo edw kai katw twra upothetoume oti paizoun paixtes pou den xeroun ta kolpa !kai topothetoun tyxaia ta pionia tous ΓΡΑΨΕ "pes mou to plhthos twn paiktwn kai tis theseis pou evale o kathenas to pioni tou" ΓΡΑΨΕ "kai tha sou vrw ton nikhth" ΔΙΑΒΑΣΕ N ΓΡΑΨΕ "dwse mou thn epilegmenh gramh" ΔΙΑΒΑΣΕ grammh ΓΙΑ i ΑΠΟ 1 ΜΕΧΡΙ N ΔΙΑΒΑΣΕ st[i] ΤΕΛΟΣ_ΕΠΑΝΑΛΗΨΗΣ !oi theseis p exei topothethsei kathe paixths to pioni tou apothikeuontai se 1 pinaka ! pou einai upeythinos gia tis sthles afou oi grammh einai koinh gia olous ΓΙΑ i ΑΠΟ 2 ΜΕΧΡΙ N ΑΝ st[i] < st[i - 1] ΤΟΤΕ temp <- st[i] st[i] <- st[i - 1] st[i - 1] <- temp ΤΕΛΟΣ_ΑΝ ΤΕΛΟΣ_ΕΠΑΝΑΛΗΨΗΣ perites <- 0 perith_found <- ΨΕΥΔΗΣ artia_found <- ΨΕΥΔΗΣ ΓΙΑ i ΑΠΟ 1 ΜΕΧΡΙ N perites <- perites + (st[i] mod 2) ΑΝ st[i] mod 2 = 0 ΚΑΙ artia_found = ΨΕΥΔΗΣ ΤΟΤΕ artia_found <- ΑΛΗΘΗΣ prwth_artia <- i ΤΕΛΟΣ_ΑΝ ΑΝ st[i] mod 2 = 1 ΚΑΙ perith_found = ΨΕΥΔΗΣ ΤΟΤΕ perith_found <- ΑΛΗΘΗΣ prwth_perith <- i ΤΕΛΟΣ_ΑΝ ΤΕΛΟΣ_ΕΠΑΝΑΛΗΨΗΣ arties <- N - perites !briskw se poses arties kai poses perites sthles uparxei pioni paixth !akoma vriskw poia einai h min perith kai h min artia sthlh sthn opoia uparxei pioni ΑΝ grammh mod 2 = 0 ΚΑΙ perites <> 0 ΤΟΤΕ ΓΡΑΨΕ "nikhths einai aytos o opoios exei topothethsei to pioni tou sth thesh" ΓΡΑΨΕ grammh, st[prwth_perith] ΑΛΛΙΩΣ_ΑΝ grammh mod 2 = 0 ΚΑΙ perites = 0 ΤΟΤΕ ΓΡΑΨΕ "nikhths einai aytos o opoios exei topothethsei to pioni tou sth thesh" ΓΡΑΨΕ grammh, st[1] ΑΛΛΙΩΣ_ΑΝ grammh mod 2 = 1 ΚΑΙ arties <> 0 ΤΟΤΕ ΓΡΑΨΕ "nikhths einai aytos o opoios exei topothethsei to pioni tou sth thesh" ΓΡΑΨΕ grammh, st[prwth_artia] ΑΛΛΙΩΣ_ΑΝ grammh mod 2 = 1 ΚΑΙ arties = 0 ΤΟΤΕ ΓΡΑΨΕ "nikhths einai aytos o opoios exei topothethsei to pioni tou sth thesh" ΓΡΑΨΕ grammh, st[1] ΤΕΛΟΣ_ΑΝ ΤΕΛΟΣ_ΠΡΟΓΡΑΜΜΑΤΟΣ