rendered paste body#include "stdafx.h"
#include <iostream>
#include <math.h>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int c0 = 2;
int c1 = 2;
int c2 = 2;
int p0 = 2;
int p1 = 1;
int p2 = 0;
int N = 2;
int V = 10;
for (int i = 0; i < N; i++) {
int temp = p0 * c0 + p1 * c1 + p2 * c2;
c2 = c1;
c1 = c0;
c0 = temp;
}
cout << "c0:" << c0 << "\n";
int wagon = ceil((float)c0 / (float)V);
cout << "wagon:" << wagon << "\n";
int places = wagon * V;
cout << "places:" << places << "\n";
int leftplaces = places - c0;
cout << "leftplaces:" << leftplaces << "\n";
if (leftplaces >= V / 2 ) {
cout << "yes\n";
} else {
cout << "no\n";
}
return 0;
}