Goharshady گفت
Olympiad گفت
يه سوال ديگه :تو آرايه چجوري بررسي كنيم كه عدد اول هست يا نه !!؟؟؟؟؟!!!








#include <iostream>
#include <conio.h>
using namespace std;
long long po(int m,int n)
{
long long ans=1;
for(int i=1;i<=n;i++)
ans*=m;
return ans;
}
int te(int k)
{
int count=0;
while(k>0)
{
count++;
k/=10;
}
return count;
}
long long t(long long k)
{
long long r=te(k)-1,f=0;
while(k>0)
{
f+=po(10,r)*(k%10);
r--;
k/=10;
}
return f;
}
int main()
{
long long s=0;
for(int i=1;i<=10000;i++)
s+=t(i);
cout<<s;
getch();
return 0;
}
#include <iostream>
#include <conio.h>
using namespace std;
long long po(int m,int n)
{
long long ans=1;
for(int i=1;i<=n;i++)
ans*=m;
return ans;
}
int te(int k)
{
int count=0;
while(k>0)
{
count++;
k/=10;
}
return count;
}
long long t(long long k)
{
long long r=te(k)-1,f=0;
while(k>0)
{
f+=po(10,r)*(k%10);
r--;
k/=10;
}
return f;
}
int main()
{
long long s=0;
while(1)
{
cout<<s<<" OK!"<<endl;
if(po(s,2)%100000<t(s))
break;
else
s++;
}
cout<<s;
getch();
return 0;
}