Skip to content

Instantly share code, notes, and snippets.

@danikin
Created September 22, 2018 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danikin/45506ed4da617ce2b6ec51653f42f9ad to your computer and use it in GitHub Desktop.
Save danikin/45506ed4da617ce2b6ec51653f42f9ad to your computer and use it in GitHub Desktop.
#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