洛谷P1008三连击

洛谷P1008三连击

#include 
const int maxn = 1e3 + 7;
using namespace std;
int main()
{
     
    int temp[12] = {
     0};
    for (int i = 192; i <= 329; i++){
     
        int flag = 1;
        fill(temp,temp+10,0);
        int a = i , b = i * 2, c = i * 3;
        while (a > 0){
     
            temp[a%10] ++;
            a = a / 10;
        }
        while (b > 0){
     
            temp[b%10] ++;
            b = b / 10;
        }
        while (c > 0){
     
            temp[c%10] ++;
            c = c / 10;
        }
        for (int j = 1; j < 10; j ++){
     
            if (temp[j] != 1){
     
                flag = 0;
                break;
            }
        }
        if (flag)
        printf("%d %d %d\n",i,2*i,3*i);
    }
    return 0;
}

你可能感兴趣的:(洛谷P1008三连击)