#include <cstdlib> #include <iostream> #include "krazki.h" #include "message.h" int main() { // Tylko zerowy komputer coś liczy. if (MyNodeId() != 0) { return EXIT_SUCCESS; } int depth; long long int max_disc_diameter = 0; for (int i = 1; i <= NumberOfDiscs(); i++) { max_disc_diameter = std::max(max_disc_diameter, DiscDiameter(i)); } if (HoleDiameter(PipeHeight()) < max_disc_diameter) { depth = 0; } else { depth = std::max(0, PipeHeight() - NumberOfDiscs() + 1); } std::cout << depth << 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 | #include <cstdlib> #include <iostream> #include "krazki.h" #include "message.h" int main() { // Tylko zerowy komputer coś liczy. if (MyNodeId() != 0) { return EXIT_SUCCESS; } int depth; long long int max_disc_diameter = 0; for (int i = 1; i <= NumberOfDiscs(); i++) { max_disc_diameter = std::max(max_disc_diameter, DiscDiameter(i)); } if (HoleDiameter(PipeHeight()) < max_disc_diameter) { depth = 0; } else { depth = std::max(0, PipeHeight() - NumberOfDiscs() + 1); } std::cout << depth << std::endl; return EXIT_SUCCESS; } |