一 问题及代码
贪婪的富翁
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double x, y = 0;
x = 100000 * 30;
for (int i = 0; i<30; i++)
{
y += pow(2, i)*0.02;
}
cout << "陌生人给富翁:" << x << endl;
cout << "富翁给陌生人:" << y << endl;
if (x>y)
{
cout << "富翁赚了" << endl;
}
else cout << "富翁亏了" << endl;
cin.get();
cin.get();
return 0;
}
二 运行结果
一 问题及代码
完数问题
#include&l