为什么会RE呢?

P1618 三连击(升级版)

Angel_wing @ 2016-09-12 20:15:44

#include<cmath>
#include<stack>
#include<queue>
#include<cstdio>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int A,B,C,ansa,ansb,ansc,num=0,ans=0;
bool used[10];
void solve()
{
    scanf("%d%d%d",&A,&B,&C);
    for (int i=123;i<=329;i++)
    {
        memset(used,0,sizeof(used));
        ansa=i;
        ansb=B*i;
        ansc=C*i;
        used[ansa/100]=1; used[(ansa/10)%10]=1; used[ansa%10]=1;
        used[ansb/100]=1; used[(ansb/10)%10]=1; used[ansb%10]=1;
        used[ansc/100]=1; used[(ansc/10)%10]=1; used[ansc%10]=1;
        for (int i=1;i<=9;i++)
        {
            if (used[i]==1) num++;
            if (num==9) printf("%d %d %d\n",ansa,ansb,ansc),ans++;
        }num=0;
    }
    if (ans==0) printf("No!!!\n");
}
int main()
{
    solve();
    return 0;
}

|