//1-9这9个数字划分成三个3位数,第一个分别是第二、三个的2倍,3倍 void myGetThreeNum(){ int j,k; int <span style="font-family: Arial, Helvetica, sans-serif;">arr</span><span style="font-family: Arial, Helvetica, sans-serif;">[10],sum ;</span> for (int i = 123; i * 3 < 987; i++) { //将arr 的 前sizeof(int) * 10个字节 清为0 memset(arr,0,sizeof(int) * 10); arr[i / 100] = 1; arr[i / 10 % 10] = 1; arr[i % 10] = 1; j = i * 2; arr[j / 100] = 1; arr[j / 10 % 10] = 1; arr[j % 10] = 1; k = i * 3; arr[k / 100] = 1; arr[k / 10 % 10] = 1; arr[k % 10] = 1; sum = 0; for (int x = 1; x < 10; x++) { sum += arr[x]; } if (sum == 9) { printf("a = %d,b = %d,c = %d\n",k,j,i); } } }
版权声明:本文为博主原创文章,未经博主允许不得转载。
时间: 2024-10-25 17:52:14