Register a blog site and apply to activate a blog the day before yesterday. Try it today !, Try the day before yesterday

Source: Internet
Author: User

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}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.