Created
September 22, 2018 11:30
-
-
Save danikin/45506ed4da617ce2b6ec51653f42f9ad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int main() | |
{ | |
int a, b, k; | |
cout << "Enter a,b,k" << endl; | |
cin >> a >> b >> k; | |
// Изначально было a деталей | |
int x = a; | |
// Итерируем каждый час | |
for (int i = 0; i < k; ++i) | |
{ | |
// Увеличиваем x на b | |
x += b; | |
} | |
// Теперь в x содержится столько деталей, сколько было сделано за k часов | |
int x_must_be = a+k*b; | |
cout << "x=" << x << ", must be " << x_must_be << endl; | |
if (x == x_must_be) | |
cout << "OK" << endl; | |
else | |
cout << "ERROR!!!" << endl; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment