#include <cstdlib>
#include <iostream>
#include "krazki.h"
#include "message.h"
int main() {
// Tylko zerowy komputer coś liczy.
if (MyNodeId() != 0) {
return EXIT_SUCCESS;
}
int pipeHeight = PipeHeight();
int numOfDiscs = NumberOfDiscs();
int poz = pipeHeight;
for (int i = 1; i <= numOfDiscs; ++i) {
for (int j = 1; j <= poz; ++j) {
if (DiscDiameter(i) > HoleDiameter(j)) {
poz = j;
break;
}
}
poz--;
}
poz++;
std::cout << poz << std::endl;
return EXIT_SUCCESS;
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include <cstdlib> #include <iostream> #include "krazki.h" #include "message.h" int main() { // Tylko zerowy komputer coś liczy. if (MyNodeId() != 0) { return EXIT_SUCCESS; } int pipeHeight = PipeHeight(); int numOfDiscs = NumberOfDiscs(); int poz = pipeHeight; for (int i = 1; i <= numOfDiscs; ++i) { for (int j = 1; j <= poz; ++j) { if (DiscDiameter(i) > HoleDiameter(j)) { poz = j; break; } } poz--; } poz++; std::cout << poz << std::endl; return EXIT_SUCCESS; } |
English