各位dalao帮蒟蒻看看怎样改才能过时限

P1618 三连击(升级版)

Minuit @ 2018-07-07 15:04:40

include<iostream>

using namespace std; int main() { int a,b,c;bool flag=true; cin>>a>>b>>c; for (int i1=1;i1<=9;i1++) for (int i2=1;i2<=9;i2++) for (int i3=1;i3<=9;i3++) for (int i4=1;i4<=9;i4++) for (int i5=1;i5<=9;i5++) for (int i6=1;i6<=9;i6++) for (int i7=1;i7<=9;i7++) for (int i8=1;i8<=9;i8++) for (int i9=1;i9<=9;i9++) { int n1=i1100+i210+i3; int n2=i4100+i510+i6; int n3=i7100+i810+i9; if ((i1!=i2)&&(i1!=i3)&&(i1!=i4)&&(i1!=i5)&&(i1!=i6)&&(i1!=i7)&&(i1!=i8)&&(i1!=i9)&&(i2!=i1)&&(i2!=i3)&&(i2!=i4)&&(i2!=i5)&&(i2!=i6)&&(i2!=i7)&&(i2!=i8)&&(i2!=i9)&&(i3!=i1)&&(i3!=i2)&&(i3!=i4)&&(i3!=i5)&&(i3!=i6)&&(i3!=i7)&&(i3!=i8)&&(i3!=i9)&&(i4!=i1)&&(i4!=i2)&&(i4!=i3)&&(i4!=i5)&&(i4!=i6)&&(i4!=i7)&&(i4!=i8)&&(i4!=i9)&&(i5!=i1)&&(i5!=i2)&&(i5!=i3)&&(i5!=i4)&&(i5!=i6)&&(i5!=i7)&&(i5!=i8)&&(i5!=i9)&&(i6!=i1)&&(i6!=i2)&&(i6!=i3)&&(i6!=i4)&&(i6!=i5)&&(i6!=i7)&&(i6!=i8)&&(i6!=i9)&&(i7!=i1)&&(i7!=i2)&&(i7!=i3)&&(i7!=i4)&&(i7!=i5)&&(i7!=i6)&&(i7!=i8)&&(i7!=i9)&&(i8!=i1)&&(i8!=i2)&&(i8!=i3)&&(i8!=i4)&&(i8!=i5)&&(i8!=i6)&&(i8!=i7)&&(i8!=i9)&&(i9!=i1)&&(i9!=i2)&&(i9!=i3)&&(i9!=i4)&&(i9!=i5)&&(i9!=i6)&&(i9!=i7)&&(i9!=i8)&&((double(n1)/n2==double(a)/b&&double(n2)/n3==double(b)/c))) { flag=false; cout<<i1100+i210+i3<<" "<<i4100+i510+i6<<" "<<i7100+i810+i9<<endl; } } if (flag) cout<<"No!!!";

}


|