水仙花数是指一个 n 位数 ( n >= 3 ),它的每个位上的数字的 n 次幂之和等于它本身。(例如:1^3 + 5^3 + 3^3 = 153)
给出一个整数M,求 >= M的最小的水仙花数。
Input
一个整数M(10 <= M <= 1000)
Output
输出>= M的最小的水仙花数
Input示例
99
Output示例
153
#include<iostream>
#include<cstring>
#include<cmath>
#include<cstdio>
#define ll long long
using namespace std;
int main()
{
//153,370,371,407
int m;
cin>>m;
if(m>=10&&m<=153)
cout<<153;
else if(m>153&&m<=370)
cout<<370;
else if(m==371)
cout<<371;
else if(m>371&&m<=407)
cout<<407;
else
cout<<1634;
}