INPUT "Kolichestvo okrugov. K="; k
INPUT "Kolichestvo partiy. M="; m
INPUT "Porog yavki izbirateley (v %). P="; p
DIM g(k, m + 1)
DIM pr(k, 1)
FOR i = 1 TO k
CLS
PRINT "Okrug "; i
g(i, 0) = i
FOR j = 1 TO m
PRINT "Golosov za partiyou "; j;
INPUT g(i, j)
pr(i, 1) = pr(i, 1) + g(i, j)
NEXT j
INPUT "Ne golosovalo "; g(i, m + 1)
pr(i, 0) = i
pr(i, 1) = 100 * pr(i, 1) / (pr(i, 1) + g(i, m + 1))
NEXT i
CLS
FOR i = 1 TO k
FOR j = 1 TO k
IF pr(i, 1) > pr(j, 1) THEN
x = pr(i, 1)
y = pr(i, 0)
pr(i, 1) = pr(j, 1)
pr(i, 0) = pr(j, 0)
pr(j, 1) = x
pr(j, 0) = y
END IF
NEXT j
NEXT i
PRINT "Itogi po golosovavshim"
PRINT "Okrug #", "Golosovalo (%)", "Pobedila partia #"
FOR i = 1 TO k
PRINT pr(i, 0), pr(i, 1),
IF pr(i, 1) >= p THEN
PRINT "Yes. Sostojlis",
max = 0
FOR j = 1 TO m
IF g(pr(i, 0), j) > max THEN
max = g(pr(i, 0), j)
x = j
END IF
NEXT j
PRINT x
ELSE PRINT "No. Ne sostojlis"
END IF
NEXT i