{
/**
* @param args
*/
public static int check(long num)
{
int[] A={0,0,0,0,0,0,0,0,0,0};
int i;
while ( num != 0)
{
i=(int) (num%10);
if (A[i]==0)
{
A[i]=1;
num=num/10;
}
else
return 0;
}
return 1;
}
public static void main(String[] args) {
// TODO Auto-generated method stub
long b=(long) Math.sqrt(1023456789);
long bn= 9876543210L;
long e=(long) Math.sqrt(bn);
int count=0;
for (long j=b;j<=e;j++)
if(check((long)(j*j))!=0)
{
count++;
System.out.println((j*j));
}
System.out.println("count::"+count);
}
}
compilation info
input / output show all hide all
# 1
* upload with new input
You have reached a limit of free submissions this month.
You cannot send submissions this month anymore because of exceeding your monthly limit. Please recharge your account.
*
# 1: hide show edit 2 days 15 hours ago
result: Success time: 0.09s memory: 213440 kB returned value: 0
input: no
output:
1026753849
1042385796
1098524736
1237069584
1248703569
1278563049
1285437609
1382054976
1436789025
1503267984
1532487609
1547320896
1643897025
1827049536
1927385604
1937408256
2076351489
2081549376
2170348569
2386517904
2431870596
2435718609
2571098436
2913408576
3015986724
3074258916
3082914576
3089247561
3094251876
3195867024
3285697041
3412078569
3416987025
3428570916
3528716409
3719048256
3791480625
3827401956
3928657041
3964087521
3975428601
3985270641
4307821956
4308215769
4369871025
4392508176
4580176329
4728350169
4730825961
4832057169
5102673489
5273809641
5739426081
5783146209
5803697124
5982403716
6095237184
6154873209
6457890321
6471398025
6597013284
6714983025
7042398561
7165283904
7285134609
7351862049
7362154809
7408561329
7680594321
7854036129
7935068241
7946831025
7984316025
8014367529
8125940736
8127563409
8135679204
8326197504
8391476025
8503421796
8967143025
9054283716
9351276804
9560732841
9614783025
9761835204
9814072356
count::87
1 comment :
int i,k,n;
long long j,nsq;
for( n = 31623 ; n < 100000 ; ++n )
{
nsq = (long long)n * (long long)n;
j = nsq;
k = 0;
for( i = 0 ; i < 10; ++i )
{
k |= (1 << (j % 10));
j /= 10;
}
if( k == 01777 )
printf("%i %lli\n",n,nsq);
}
It finds 76 answers in the blink of an eye, the first being 32043^2
and the last being 99066^2.
Post a Comment