about summary refs log tree commit diff
path: root/others/volume1/007.pas
diff options
context:
space:
mode:
Diffstat (limited to 'others/volume1/007.pas')
-rw-r--r--others/volume1/007.pas18
1 files changed, 18 insertions, 0 deletions
diff --git a/others/volume1/007.pas b/others/volume1/007.pas
new file mode 100644
index 0000000..8a544b2
--- /dev/null
+++ b/others/volume1/007.pas
@@ -0,0 +1,18 @@
+var
+  n, i: int64;
+  a, b, c: smallint;
+
+begin
+  readln(n);
+  a := 1;
+  b := 1;
+  i := 2;
+  while i < n do
+    begin
+      c := a;
+      a := b;
+      b := (c + a) mod 1000;
+      inc(i)
+    end;
+  writeln(b)
+end.