gitweb on Svarog
projekti pod git sistemom za održavanje verzija -- projects under the git version control system
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2e4eba4)
raw | patch | inline | side by side (parent: 2e4eba4)
author | Doni Pracner <quinnuendo@gmail.com> | |
Wed, 6 Nov 2013 12:24:40 +0000 (13:24 +0100) | ||
committer | Doni Pracner <quinnuendo@gmail.com> | |
Wed, 6 Nov 2013 12:24:40 +0000 (13:24 +0100) |
05. NizDin/NIZDIN.MOD | [deleted file] | patch | blob | history |
05. NizDin/kod/NIZDIN.MOD | [new file with mode: 0644] | patch | blob |
diff --git a/05. NizDin/NIZDIN.MOD b/05. NizDin/NIZDIN.MOD
--- a/05. NizDin/NIZDIN.MOD
+++ /dev/null
@@ -1,65 +0,0 @@
-MODULE NizDin;\r
-\r
- FROM IO IMPORT\r
- WrStr, RdInt, WrInt;\r
-\r
- CONST\r
- MaxN = 1000;\r
-\r
- VAR\r
- a, b: ARRAY [0 .. MaxN] OF INTEGER;\r
- (* b[i] je suma elemenata u resenju za *)\r
- (* deo niza 'a' do 'i'-tog elementa *)\r
- n: INTEGER;\r
-\r
- PROCEDURE Unos;\r
- VAR\r
- i: CARDINAL;\r
- BEGIN\r
- WrStr('Unesite N: ');\r
- n:= RdInt();\r
- FOR i:= 1 TO n DO\r
- WrStr('A[');\r
- WrInt(i, 1);\r
- WrStr('] = ');\r
- a[i]:= RdInt();\r
- END;\r
- END Unos;\r
- \r
- PROCEDURE Resi;\r
- VAR\r
- i, j, Pom: CARDINAL;\r
- BEGIN\r
- b[0]:= 0;\r
- IF a[1] > 0 THEN\r
- b[1]:= a[1];\r
- ELSE\r
- b[1]:= 0;\r
- END;\r
- FOR i:= 2 TO n DO\r
- IF b[i - 2] + a[i] > b[i - 1] THEN\r
- b[i]:= b[i - 2] + a[i];\r
- ELSE\r
- b[i]:= b[i - 1];\r
- END\r
- END;\r
- END Resi;\r
-\r
- PROCEDURE Ispis(n: CARDINAL);\r
- BEGIN\r
- IF n > 0 THEN\r
- IF b[n] = b[n - 1] THEN\r
- Ispis(n - 1);\r
- ELSE\r
- Ispis(n - 2);\r
- WrInt(a[n], 8);\r
- END;\r
- END;\r
- END Ispis;\r
-\r
-BEGIN\r
- Unos;\r
- Resi;\r
- WrStr('Podniz: ');\r
- Ispis(n);\r
-END NizDin.\r
diff --git a/05. NizDin/kod/NIZDIN.MOD b/05. NizDin/kod/NIZDIN.MOD
--- /dev/null
@@ -0,0 +1,65 @@
+MODULE NizDin;\r
+\r
+ FROM IO IMPORT\r
+ WrStr, RdInt, WrInt;\r
+\r
+ CONST\r
+ MaxN = 1000;\r
+\r
+ VAR\r
+ a, b: ARRAY [0 .. MaxN] OF INTEGER;\r
+ (* b[i] je suma elemenata u resenju za *)\r
+ (* deo niza 'a' do 'i'-tog elementa *)\r
+ n: INTEGER;\r
+\r
+ PROCEDURE Unos;\r
+ VAR\r
+ i: CARDINAL;\r
+ BEGIN\r
+ WrStr('Unesite N: ');\r
+ n:= RdInt();\r
+ FOR i:= 1 TO n DO\r
+ WrStr('A[');\r
+ WrInt(i, 1);\r
+ WrStr('] = ');\r
+ a[i]:= RdInt();\r
+ END;\r
+ END Unos;\r
+ \r
+ PROCEDURE Resi;\r
+ VAR\r
+ i, j, Pom: CARDINAL;\r
+ BEGIN\r
+ b[0]:= 0;\r
+ IF a[1] > 0 THEN\r
+ b[1]:= a[1];\r
+ ELSE\r
+ b[1]:= 0;\r
+ END;\r
+ FOR i:= 2 TO n DO\r
+ IF b[i - 2] + a[i] > b[i - 1] THEN\r
+ b[i]:= b[i - 2] + a[i];\r
+ ELSE\r
+ b[i]:= b[i - 1];\r
+ END\r
+ END;\r
+ END Resi;\r
+\r
+ PROCEDURE Ispis(n: CARDINAL);\r
+ BEGIN\r
+ IF n > 0 THEN\r
+ IF b[n] = b[n - 1] THEN\r
+ Ispis(n - 1);\r
+ ELSE\r
+ Ispis(n - 2);\r
+ WrInt(a[n], 8);\r
+ END;\r
+ END;\r
+ END Ispis;\r
+\r
+BEGIN\r
+ Unos;\r
+ Resi;\r
+ WrStr('Podniz: ');\r
+ Ispis(n);\r
+END NizDin.\r