summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorSanto Cariotti <sancn@live.com>2017-05-27 15:32:20 +0200
committerSanto Cariotti <sancn@live.com>2017-05-27 15:32:20 +0200
commit09422247fe86c55961ffd53587fe0ea8772e452c (patch)
treecb7778c732ee1d702228c9e94209bc10cf138c87 /cpp
parent7c88519ee77ea85ec6bbdc0fa45f2e2b26422a57 (diff)
added travis
Diffstat (limited to 'cpp')
-rw-r--r--cpp/Makefile6
-rw-r--r--cpp/checksum.cpp8
-rw-r--r--cpp/lswf.cpp73
3 files changed, 0 insertions, 87 deletions
diff --git a/cpp/Makefile b/cpp/Makefile
deleted file mode 100644
index ad5e8f5..0000000
--- a/cpp/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
-CC=g++
-CFLAGS=-o
-CVERSION=c++11
-
-$1: $1.cpp
- $(CC) -Wall -std=$(CVERSION) $(CFLAGS) $1 $1.cpp
diff --git a/cpp/checksum.cpp b/cpp/checksum.cpp
deleted file mode 100644
index e80398f..0000000
--- a/cpp/checksum.cpp
+++ /dev/null
@@ -1,8 +0,0 @@
-#include <iostream>
-#include <fstream>
-
-int main()
-{
-
- return 0;
-}
diff --git a/cpp/lswf.cpp b/cpp/lswf.cpp
deleted file mode 100644
index dcf1b13..0000000
--- a/cpp/lswf.cpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/* INPUT:
- * 19
- *
- * OUTPUT:
- * 1000101
- */
-#include <iostream>
-#include <fstream>
-#include <list>
-#define MAXG 1000001
-
-int fibonacci(int* fib, int N)
-{
- fib[0] = 1; fib[1] = 1;
- int lst;
-
- for(int i = 2; i < N; i++) {
- fib[i] = fib[i-1] + fib[i-2];
- lst = i;
- if(fib[i] > N) break;
- }
-
- return lst;
-}
-
-int main()
-{
- std::ifstream in("input.txt");
- std::ofstream out("output.txt");
- std::list<int> seq;
- std::list<int>::iterator j;
-
- int N, i;
- in >> N;
- int caracts[MAXG], somma = 0, potSomma;
- int lastc;
-
- if(N > 4)
- lastc = fibonacci(caracts, N);
- else {
- caracts[0] = 1;
- for(i = 1; i < 4; i++)
- caracts[i] = i;
-
- switch (N) {
- case 1:
- lastc = 1;
- break;
- case 2:
- lastc = 2;
- break;
- case 3:
- lastc = 3;
- break;
- default:
- lastc = 4;
- }
- }
-
- for(i = lastc; i > 0; i--) {
- potSomma = somma + caracts[i];
- if(potSomma < N) {
- somma = potSomma;
- seq.push_front(1);
- } else seq.push_front(0);
- }
- seq.push_front(1);
- for(j = seq.begin(); j != seq.end(); j++) out << *j;
-
- in.close();
- out.close();
- return 0;
-}