Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
7325 林思仪 水仙花数 C++ Accepted 2 MS 748 KB 326 2021-03-06 19:27:11

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; bool check(int x){ int a=x/100,b=x%100/10,c=x%10; return x==(a*a*a+b*b*b+c*c*c); } int main(){ //freopen("data.txt","r",stdin); int i,j,l,r,cnt=0; cin>>l>>r; for(i=l;i<=r;i++){ if(check(i)){ cnt++; printf("%d ",i); } } if(cnt==0)printf("no"); }