#5 RE求助

P1618 三连击(升级版)

SfumatoCannon_ @ 2018-10-26 21:23:54

在本地测试了#5的输入输出是对的,为什么一放到洛谷上就RE捏

#include<cstdio>
#include<cstring>
using namespace std;
int main()
{
    int x,y,z,a,b,c,m[10],i,j,t=0;
    bool flag;
    scanf("%d%d%d",&x,&y,&z);
    for (i=1;i<=333;i++)
    {
        memset(m,0,sizeof(m));
        flag=true;
        a=i*x;
        b=i*y;
        c=i*z;
        m[a/100]=1;
        m[a/10%10]=1;
        m[a%10]=1;
        m[b/100]=1;
        m[b/10%10]=1;
        m[b%10]=1;
        m[c/100]=1;
        m[c/10%10]=1;
        m[c%10]=1;
        for (j=1;j<=9;j++)
            if (m[j]==0)
            {
                flag=false;
                break;
            }
        if (flag) 
        {
            t++;
            printf("%d %d %d\n",a,b,c);
        }
    }
    if (t==0) printf("No!!!");
    return 0;
}

by wanhaochen @ 2018-10-26 21:46:42

include<bits/stdc++.h>

using namespace std; int main() { int x,y,z,a,b,c,m[100000],i,j,t=0; bool flag; cin>>x>>y>>z; for (i=1;i<=333;i++) { memset(m,0,sizeof(m)); flag=true; a=ix; b=iy; c=i*z; m[a/100]=1; m[a/10%10]=1; m[a%10]=1; m[b/100]=1; m[b/10%10]=1; m[b%10]=1; m[c/100]=1; m[c/10%10]=1; m[c%10]=1; for (j=1;j<=9;j++) if (m[j]==0) { flag=false; break; } if (flag) { t++; cout<<a<<" "<<b<<" "<<c<<endl; } } if (t==0) cout<<"No!!!"; return 0; }


by wanhaochen @ 2018-10-26 21:49:05

include<bits/stdc++.h>

using namespace std;

int main()

{

int x,y,z,a,b,c,m[100000],i,j,t=0;

bool flag;
cin>>x>>y>>z;
for (i=1;i<=333;i++)
{
    memset(m,0,sizeof(m));
    flag=true;
    a=i*x;
    b=i*y;
    c=i*z;
    m[a/100]=1;
    m[a/10%10]=1;
    m[a%10]=1;
    m[b/100]=1;
    m[b/10%10]=1;
    m[b%10]=1;
    m[c/100]=1;
    m[c/10%10]=1;
    m[c%10]=1;
    for (j=1;j<=9;j++)
        if (m[j]==0)
        {
            flag=false;
            break;
        }
    if (flag) 
    {
        t++;
        cout<<a<<" "<<b<<" "<<c<<endl;
    }
}
if (t==0) cout<<"No!!!";
return 0;

}


|