which datatype should i use to store a value of about 10 raise to power 10000 ???
You must use an array for that purpose.
Languages like C ,C++ have long long int data type which can store a no. having upto approx 18 digits.
You should store it in user defined data type,i.e an int array.You can learn how to store each digit in an array on this http://www.codechef.com/wiki/tutorial-small-factorials.
As none of the pre-defined data types can’t accommodate such a large number.
Hope this might help you!
Here’s the code that you may like to view after reading the above tutorial:-
#include< iostream >
using namespace std;
void power(int a,int b)
{ int pow[11000];
int m=1,carry=0;
pow[1]=1;
for(int i=1;i<=b;i++)
{
for(int j=1;j<=m;j++)
{
int c=pow[j]*a+carry;
pow[j]=c%10;
carry=c/10;
}
while(carry!=0)
{
m=m+1;
pow[m]=carry%10;
carry/=10;
}
}
for(int i=m;i>=1;i--)
cout<< pow[i];
cout<< "\n";
}
int main()
{int x,y;
cin>>x>>y;
power(x,y);
return 0;}
Voila!!
You have to realize, that are many languages CodeChef suports, so you have to specify in which you are programming, otherwise you will get answers about python for example…