diff options
author | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2020-06-06 21:33:13 +0700 |
---|---|---|
committer | Nguyễn Gia Phong <mcsinyx@disroot.org> | 2020-06-06 21:33:13 +0700 |
commit | 2f674dc80f0382f1c3178f435714960734dc9d3c (patch) | |
tree | 2abba7e4ec72bd16f58f7375126144d3fd9f4bca /09/TP-HN-2014/cau2.cpp | |
parent | b2d80610db6beda38573890ed169815e495bc663 (diff) | |
download | cp-2f674dc80f0382f1c3178f435714960734dc9d3c.tar.gz |
Reorganize stuff from secondary school
Diffstat (limited to '09/TP-HN-2014/cau2.cpp')
-rw-r--r-- | 09/TP-HN-2014/cau2.cpp | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/09/TP-HN-2014/cau2.cpp b/09/TP-HN-2014/cau2.cpp deleted file mode 100644 index 8c87168..0000000 --- a/09/TP-HN-2014/cau2.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include <stdlib.h> -#include <iostream> -#include <fstream> - -using namespace std; - -int -main() -{ - ifstream infile; - infile.open("CAU2.INP"); - short n, i, j; - long d, count = 0; - infile >> n >> d; - short* v = (short*) malloc(n * sizeof(short)); - for (i = 0; i < n; i++) - { - infile >> v[i]; - for (j = 0; j < i; j++) - if (d * (v[i] - v[j]) > v[i] * v[j] * (i - j)) - count++; - } - infile.close(); - free(v); - - ofstream outfile; - outfile.open("CAU2.OUT"); - outfile << count << endl; - outfile.close(); - - return 0; -} |