60分求调

P1618 三连击(升级版)

vscdr_ @ 2024-11-10 11:05:30

#include<bits/stdc++.h>
using namespace std;
constexpr int N = 100;
int a[N];
int b1, b2, b3;
bool flag = false;
int main()
{

    a[1] = 1, a[2] = 9, a[3] = 2, a[4] = 3, a[5] = 8, a[6] = 4, a[7] = 5, a[8] = 7;
    a[9] = 6;
    //cout << "192 384 576";
    cin >> b1 >> b2 >> b3;
    do
    {
        int ka, kb, kc;
        ka = a[1] * 100 + a[2] * 10 + a[3];
        kb = a[4] * 100 + a[5] * 10 + a[6];
        kc = a[7] * 100 + a[8] * 10 + a[9];

        if (ka*b2==kb*b1 && kb*b3==kc*b2)
        {
            cout << ka << ' ' << kb << ' ' << kc << '\n';
            flag = true;
        }
    } while (next_permutation(a + 1, a + 1 + 9));
    if (!flag) cout << "No!!!\n";
    return 0;
}

by vscdr_ @ 2024-11-10 11:06:09

我在某垃圾oj上ac了,结果你谷60分了


by zyt__dp @ 2024-11-11 13:30:53

@vscdr_你也别这么说吧 不要跟风


|