60分快疯了,2,3测试点wa,求助求助

P1618 三连击(升级版)

Aheaddd @ 2021-09-16 12:24:55

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;    

int A, B, C, flag;

int main()
{
    cin >> A >> B >> C;
    for (int a = 1; a <= 9; a++)
    {
        for (int b = 1; b <= 9; b++)
        {
            for (int c = 1; c <= 9; c++)
            {
                if ( a != b && a != c && b != c)
                {
                    for (int d = 1; d <= 9; d++)
                    {
                        for (int e = 1; e <= 9; e++)
                        {
                            for (int f = 1; f <= 9; f++)
                            {
                                if (d != e && d != f && e != f && d != a && d != b && d != c && e != a && e != b && e != c&&f!=a&&f!=b&&f!=c)
                                {
                                    for (int g = 1; g <= 9; g++)
                                    {
                                        for (int h = 1; h <= 9; h++)
                                        {
                                            for (int i = 1; i <= 9; i++)
                                            {
                                                if (g != h && g != i && h != i && g != a && g != b && g != c && g != d && g != e && g != f && i != a && i != b && i != c && i != d && i != e && i != f && h != a && h != b && h != c && h != d && h != e && h != f)
                                                {
                                                    int aa = a * 100 + b * 10 + c;
                                                    int bb = d * 100 + e * 10 + f;
                                                    int cc = g * 100 + h * 10 + i;
                                                    if (double (aa)/A == double (bb)/B && double (aa)/A == double (cc)/C && double (bb)/B == double (cc)/C)
                                                    {
                                                        cout << a << b << c << " " << d << e << f << " " << g << h << i << endl;
                                                        flag = 1;
                                                    }                                                   
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
    if (flag == 0)cout << "NO!!!";

    return 0;
}

by xxx听取AC声一片 @ 2021-09-16 12:50:39

感觉这像一首古诗: 七八个点ac,两三点wa。旧时暴力不能过,现在还是不会。


by fjy666 @ 2021-09-16 13:12:43

您的代码能力高超%%%


by Aheaddd @ 2021-09-16 15:08:25

@fjy666 蒟蒻一枚,代码改了又改,两点wa却一直在qwq


by Aheaddd @ 2021-09-16 15:47:24

原来,困扰我几个小时的问题,是No的o被我写成O,


by lxdyz @ 2022-04-30 23:24:36

@Aheaddd 草 看到你的我也一样还多了两个空格 40分,改了变80分了。


|