[AkOJ] 1114-Daffodils, akoj1114-Daffodils

Source: Internet
Author: User

[AkOJ] 1114-Daffodils, akoj1114-Daffodils

1114 daffodils

Time Limit: 1000 MS Memory Limit: 65536 K
Total Submit: 919 Accepted: 294

Original question link

Description

The number of all daffodils in the output range [a, B]. If the three numbers ABC meet the requirements of ABC = A ^ 3 + B ^ 3 + C ^ 3, they are called daffodils. For example, 153 = 1 ^ 3 + 5 ^ 3 + 3 ^ 3, so 153 is the number of daffodils.

Input

One interval [a, B], B> a> 0

Output

The number of all daffodils in the output range [a, B] (one row per row)

Sample Input

 

100 154

 

Sample Output

 

 

 

Hint

153

Source

Lrj program entry

 

 

 1 #include<stdio.h> 2 int main() 3 { 4     int a,b,i; 5     scanf("%d%d",&a,&b); 6     for(i=a;i<=b;i++) 7     { 8         if(i<=999&&i>=100&&(i/100)*(i/100)*(i/100)+(i/10%10)*(i/10%10)*(i/10%10)+(i%10)*(i%10)*(i%10)==i) 9         {10             printf("%d\n",i);11         }12     }13     return 0;14 }

 

Related Article

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.