diff options
author | Santo Cariotti <sancn@live.com> | 2017-04-26 16:37:39 +0200 |
---|---|---|
committer | Santo Cariotti <sancn@live.com> | 2017-04-26 16:37:39 +0200 |
commit | 483d63fa7249ad8d6020680c48c3cf6df35010b3 (patch) | |
tree | 2f8649e3ae6b42ace5011246285c9c450f004222 /bicicletta.c++ | |
parent | 6c957dc4e01aee6ce9cae3c8342d04b0fd9ca9c4 (diff) |
Moved all C++ files into CPP folder
Diffstat (limited to 'bicicletta.c++')
-rw-r--r-- | bicicletta.c++ | 62 |
1 files changed, 0 insertions, 62 deletions
diff --git a/bicicletta.c++ b/bicicletta.c++ deleted file mode 100644 index bb42031..0000000 --- a/bicicletta.c++ +++ /dev/null @@ -1,62 +0,0 @@ -/* INPUT: -3 4 -2 -3 -1 -1 3 -1 2 -3 2 -3 1 - -OUTPUT: -3 -*/ - -#include <iostream> -#include <fstream> - -using namespace std; - -int main(void) -{ - ifstream in; - ofstream out; - in.open("input.txt"); - out.open("output.txt"); - - int numBici, sorpassi, i, x, j, y, m[2]; - in >> numBici; - in >> sorpassi; - - int* posBici = new int[numBici]; - - // posizioni di base - for(i = 0; i < numBici; i++) - in >> posBici[i]; - - // sorpassi - for(i = 0; i < sorpassi; i++) - { - in >> x; - in >> y; - - for(j = 0; j < numBici; j++) - { - if(posBici[j] == x) m[0] = j; //indice valore che sorpassa - - if(posBici[j] == y) m[1] = j; //indice valore che viene sorpassato - } - - posBici[m[0]] = y; - posBici[m[1]] = x; - } - - out << posBici[0]; - - delete[] posBici; - - in.close(); - out.close(); - - return 0; -} |