Description
Spring is the season of flowers, Narcissus is one of the most charming representatives, there is a number of daffodils in mathematics, he is defined as: "Narcissus number" refers to a three-digit number, its number of the cubic and equal to itself, such as: 153=1^3+5^3+3^3. It is now required to output all the number of daffodils in the M and N ranges.
Input
There are multiple groups of input data, one row for each group, including two integers m and n (100<=m<=n<=999).
Output
For each test instance, it is required to output all the number of daffodils in a given range, that is, the output of daffodils must be greater than or equal to M, and less than or equal to N, if there are multiple, then the order from small to large lines in the output, separated by a space; If the number of daffodils does not exist within the given range, the output is no; The output for each test instance takes one row.
/* All rights reserved. * File name: Test.cpp * Chen Dani * Completion Date: May 11, 2015 * Version number: v1.0 */#include <iostream>using namespace Std;int main () {in T m,n; while (Cin>>m>>n) { int j=0; for (int i=m; i<=n; i++) { int a,b,c; a=i/100; b= (I/10)%10; c=i%10; if (a*a*a+b*b*b+c*c*c==i) { cout<<i<< ""; j + +; } } cout<<endl; if (j==0) cout<< "No" <<endl; } return 0;}
C + + Brush question-Narcissus number