Search found 1 match

by kalochita
Thu May 19, 2011 10:12 pm
Forum: Volume 119 (11900-11999)
Topic: 11970 - Lucky Numbers
Replies: 7
Views: 5436

Re: 11970 - Lucky Numbers

#include<iostream>
#include<math.h>
using namespace std;

int main()
{
int T;
cin>>T;
long long N,x,s;
for(int j=1;j<=T;j++)
{
cin>>N;
long rt=sqrt(N-1);

cout<<"case "<<j<<":";
for(long i=rt;i>=1;i--)
{
s=i*i;
x=N-s;
if(x%i==0)
cout<<" "<<x;

}
if(j!=T)
cout<<"\n";
}
return 0 ...

Go to advanced search