1 条题解

  • 0
    @ 2025-2-14 20:39:29

    C++ :

    #include<bits/stdc++.h>
    using namespace std;
    int n,m,t,a,b,c,s;
    int main(){
    	cin>>n>>m;
    	if(n>m)swap(n,m);
        for(int i=n;i<=m;i++)
    	{
    		t=i;a=t/100;b=t/10%10;c=t%10;
    		if(pow(a,3)+pow(b,3)+pow(c,3)==t)cout<<t<<endl,s++;
    	}
    	if(s==0)cout<<"NO";
        return 0;
    }
    

    Pascal :

    var a,b,c,e,s,i,f :longint;
    begin
    readln(a,b);
    for i:=a to b do
    begin
    c:=i;s:=0;
    repeat
    e:=c div 10;
    b:=c mod 10;
    c:=e;
    s:=s+b*b*b;
    until c=0;
    if i=s then
    begin
    writeln(i);
    inc(f);
    end;
    end;
    if f=0 then
    write('NO');
    end.
    
    
    • 1

    信息

    ID
    331
    时间
    1000ms
    内存
    128MiB
    难度
    10
    标签
    递交数
    1
    已通过
    1
    上传者