40分...求助!!大佬康康我!

P1618 三连击(升级版)

四宮_明羽 @ 2019-11-12 15:10:36

#include <iostream>
int main(){
    using namespace std;
    int example[1000],a,b,c,ans=0;
    cin>>a;
    cin>>b;
    cin>>c;

    for (int i=101;i<=1000;i++){
        example[i-101]=i-1;
    }

    for(int i=101;i<=1000;i++){
        int compare1=example[i-101]*a;
        int compare2=compare1*b;
        if (compare2<=999){

            int compare3=compare1*c;
            if(compare3<=999){
                int a1=compare1/100;
                int a2=(compare1%100)/10;
                int a3=(compare1%100)%10;
                int b1=compare2/100;
                int b2=(compare2%100)/10;
                int b3=(compare2%100)%10;
                int c1=compare3/100;
                int c2=(compare3%100)/10;
                int c3=(compare3%100)%10;
                if (a1!=a2&&a2!=a3&&a3!=b1&&b1!=b2&&b2!=b3&&b3!=c1&&c1!=c2&&c2!=c3&&a1!=0&&a2!=0&&a3!=0&&b1!=0&&b2!=0&&b3!=0&&c1!=0&&c2!=0&&c3!=0&&a1!=a3&&a1!=b1&&a1!=b2&&a1!=b3&&a1!=c1&&a1!=c2&&a1!=c3&&a2!=b1&&a2!=b2&&a2!=b3&&a2!=c1&&a2!=c2&&a2!=c3&&a3!=b2&&a3!=b3&&c1&&a3!=c2&&a3!=c3&&b1!=b3&&b1!=c1&&b1!=c2&&b1!=c3&&b2!=c1&&b2!=c2&&b2!=c3&&b3!=c1&&b3!=c2&&b3!=c3&&c1!=c2&&c1!=c3&&c2!=c3)
                    cout<<compare1<<" "<<compare2<<" "<<compare3<<endl;
                ans++;
            }
        }
    }

    if(ans == 0)
        cout<<"No!!!"<<endl;
    return 0;
}

by 四宮_明羽 @ 2019-11-12 15:24:17

输入1:5:7的话就没有输出,不知道为什么


by 四宮_明羽 @ 2019-11-12 15:39:48

忘记打a3!=c1了..尴尬


by 四宮_明羽 @ 2019-11-12 15:40:12

80分了...最后一个为什么过不了


|