Register a blog site and apply to activate a blog the day before yesterday. Try it today !, Try the day before yesterday
Primary Mathematics: two four-digit numbers.
The eight natural numbers from 1 to 8 form two four-digit numbers (which cannot be reused). One of the four-digit numbers is four times that of the other. What are the four-digit numbers?
Was the first day of the postgraduate entrance exam. I saw a primary school math question from Netease.
Primary school math students count for half an hour. Fortunately, we studied early.
Address: http://kids.163.com/13/0105/09/8KEO72BF00294KT7.html
1 # include <iostream> 2 using namespace std; 3 4 int main (void)/* name: num4.cpp */5 {int digit [10], n, m, I, t, flag; 6 for (n = 1234; n <2500; n ++) 7 {for (I = 0; I <10; I ++) digit [I] = 0; 8 t = n; 9 while (t> 0) 10 {digit [t % 10] ++; 11 t/= 10; 12} 13 t = n * 4; 14 while (t> 0) 15 {digit [t % 10] ++; 16 t/= 10; 17} 18 flag = 1; 19 for (I = 1; I <9 & flag = 1; I ++) 20 if (digit [I]! = 1) 21 flag = 0; 22 if (flag) cout <n <"," <4 * n <endl; 23} 24 25 return 0; 26}