-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathProjectEuler#4.c
46 lines (40 loc) · 1.25 KB
/
ProjectEuler#4.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
long long int t,k,n,i,x,z,y,j,max=0;
scanf("%lld",&t);
for(k=0;k<t;k++)
{
scanf("%lld",&n);
for(i=100;i<=999;i++)
{
for(j=i+1;j<=999;j++)
{
x=i*j;
z=x;
if(x<n)
{
y=0;
while(x!=0)
{
y=y*10;
y=y+x%10;
x=x/10;
}
if(z==y)
{
if(z>max)
{
max=z;
}
}
}
}
}
printf("%lld\n",max);
max=0;
}
return 0;
}