This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATA=../data_2000_50000.in | |
NB_RUN=10 | |
for SOURCE in $(ls *.cxx); | |
do | |
EXEC=${SOURCE%.cxx} | |
[ ! -e ${EXEC} ] && g++-snapshot -std=c++11 ${SOURCE} -o ${EXEC} -O4 -march=native -Wno-deprecated | |
echo -ne ${EXEC}'\t' | |
for i in $(seq ${NB_RUN}); | |
do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
#include <cstddef> | |
#include <iostream> | |
#include <iterator> | |
//g++ -std=c++0x balance.cxx -o balance_cxx -O4 -march=native | |
int main(int argc, char* argv[]) { | |
for(std::istream_iterator<int64_t> in(std::cin),e; in!=e && *in; ){ | |
int64_t res(0); | |
for(int64_t i(0),nb(*in++); i != nb; ++i,++in) | |
{ res+= (i < (nb /2)) ? *in : ((i > (nb /2) ||(nb %2 == 0 )) ? -*in :0); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(def fib-seq | |
"lazy seq of Fibonacci numbers" | |
(lazy-cat [0 1] (map + (rest fib-seq) fib-seq))) | |
NewerOlder