- 过河
- 2014-02-03 18:32:05 @
编译失败(CompileError)
foo.cpp: In function 'int recu(float, int)':
foo.cpp:11:13: error: reference to 'min' is ambiguous
if (Sst < min)
^
foo.cpp:3:5: note: candidates are: int min
int min=1000;
^
#include<iostream>
using namespace std;
int min;
float L;
int S, T, M;//最小,最大,石子数;
float st[101];
int recu(float now,int Sst)
{
if (now >= L)
{
if (Sst < min)
min = Sst;
}
else
{
for (int i = S; i <= T; i++)
{
float temp = now + i;
bool cai = false;
for (int j = 1; j <= M; j++)
{
if (temp == st[j])
{
cai = true;
break;
}
}
if (cai==true)
recu(now + i, Sst + 1);
else
recu(now + i, Sst);
}
}
return 0;
}
int main()
{
cin >> L;
cin >> S >> T >> M;
for (int i = 1; i <= M; i++)
{
cin >> st[i];
}
recu(0,0);
cout << min<<endl;
//system("pause");
}
1 条评论
-
Towerlight LV 10 @ 2014-02-03 19:56:19
把min改成minn……否则会和min函数重名的……
- 1