about summary refs log tree commit diff
path: root/daily/286easy/lairotcaf.pas
diff options
context:
space:
mode:
authorRaphael McSinyx <vn.mcsinyx@gmail.com>2016-10-08 09:56:43 +0700
committerRaphael McSinyx <vn.mcsinyx@gmail.com>2016-10-08 09:56:43 +0700
commit2a7bc10f6c011d19fb3b0e73068f7e1a9c30ace0 (patch)
tree95190a32ec1c7098494849eea5a5ba6b53289585 /daily/286easy/lairotcaf.pas
parent207cc2ae9893b0cdecd20119b9ede37f73cd4a1e (diff)
downloadcp-2a7bc10f6c011d19fb3b0e73068f7e1a9c30ace0.tar.gz
Initial commit
Diffstat (limited to 'daily/286easy/lairotcaf.pas')
-rw-r--r--daily/286easy/lairotcaf.pas31
1 files changed, 31 insertions, 0 deletions
diff --git a/daily/286easy/lairotcaf.pas b/daily/286easy/lairotcaf.pas
new file mode 100644
index 0000000..ef2c910
--- /dev/null
+++ b/daily/286easy/lairotcaf.pas
@@ -0,0 +1,31 @@
+var
+  fi, fo: text;
+  n, i: int64;
+
+begin
+  assign(fi, 'lairotcaf.inp');
+  assign(fo, 'lairotcaf.out');
+  reset(fi);
+  rewrite(fo);
+  repeat
+    readln(fi, n);
+    write(fo, n);
+    if n > 0 then
+      begin
+        i := 2;
+        while n mod i = 0 do
+          begin
+            n := n div i;
+            inc(i)
+          end;
+        if n = 1 then
+          begin
+            writeln(fo, ' = ', i - 1, '!');
+            continue
+          end
+      end;
+    writeln(fo, ' NONE')
+  until eof(fi);
+  close(fi);
+  close(fo)
+end.