#include<cstdio>
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<queue>
using namespace std;
struct node{
int a,b,c,t;
};
queue <node> q;
int a,b,c;
void bfs()
{
node h,t;
t={a,b,c,0};
q.push(t);
while(!q.empty())
{
h=q.front();
q.pop();
int A=h.a;
int B=h.b;
int C=h.c;
if(A==B && B==C)
{
cout<<h.t;
return;
}
if(A<B && A<C)
{
t={A+2,B,C,h.t+1};
q.push(t);
}
if(B<A && B<C)
{
t={A,B+2,C,h.t+1};
q.push(t);
}
if(C<A && C<B)
{
t={A,B,C+2,h.t+1};
q.push(t);
}
if(A<B && C<B)
{
t={A+1,B,C+1,h.t+1};
q.push(t);
}
if(A<C && B<C)
{
t={A+1,B+1,C,h.t+1};
q.push(t);
}
if(C<A && B<A)
{
t={A,B+1,C+1,h.t+1};
q.push(t);
}
}
}
int main()
{
freopen("same.in","r",stdin);
freopen("same.out","w",stdout);
cin>>a>>b>>c;
bfs();
return 0;
}
没有数组超出限制啊,为啥会mle啊