|
|
вернуться в форумWrong answer (3) #include <iostream> #include <iomanip> int main() { unsigned short int p1, c1; unsigned short int p2, t, c2; unsigned short int p3; unsigned short int k; unsigned short int mm, ss; char s = ':'; std::cin >> p1 >> c1; std::cin >> p2 >> t >> c2; std::cin >> p3; std::cin >> k; for (int i=1; i<=k; i++) { std::cin >> mm >> s >> ss; if (mm>0 || ss>7) { if (ss!=0) mm++; p1 = p1 + mm*c1; if (mm>t) { mm-=t; t=0; } else { t-=mm; mm=0; } p2 = p2 + mm*c2; } } std::cout << setiosflags(std::ios::left) << std::setw(11) << "Basic: " << p1 << std::endl; std::cout << setiosflags(std::ios::left) << std::setw(11) << "Combined: " << p2 << std::endl; std::cout << setiosflags(std::ios::left) << std::setw(11) << "Unlimited: " << p3 << std::endl; return 0; } What's wrong? |
|
|