求解只有60....找不到错误

P1618 三连击(升级版)

feather @ 2017-07-26 23:56:38

#include<iostream>
using namespace std;
int A, B, C;
int main()
{
    cin >> A >> B >> C;//保证了A < B < C
    for(int i = 1; i <= 999; i++){
        int a = i*A, b = i*B, c = i*C;
        if(c > 999) break;//超出范围
        if(a < 100) continue;//不是3位数
        int num[10] = {0};
        num[a%10]++;
        num[a/10%10]++;
        num[a/100]++;
        num[b%10]++;
        num[b/10%10]++;
        num[b/100]++;
        num[c%10]++;
        num[c/10%10]++;
        num[c/100]++;
        bool flag = true;
        for(int j = 1; j <= 9; j++)
            if(num[j] != 1){ flag = false; break; }
        if(flag) cout << a << ' ' << b << ' ' << c << endl;
    }
    return 0;
}

by feather @ 2017-07-26 23:59:38

不用了,... 无解输出NO...


by 文艺平衡树 @ 2017-08-07 13:53:34

+1 忘记输出No。


by Vigiler @ 2017-09-17 21:30:14

...


|