<span style="font-size:24px;">下面是不压位的正常版:</span>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
const int maxn=1010;
struct big{
int s[maxn],len;
big(){
memset(s,0,sizeof(s)); len=1;
}
big operator=(const char *num){
len=strlen(num);
for(int i=0;i<len;i++) s[i]=num[len-1-i]-'0';
return *this;
}
big operator=(const int num){
char a[maxn];
sprintf(a,"%d",num);
*this=a;
return *this;
}
big(const char *num){
*this=num;
}
big (const int num){
*this=num;
}
big operator+(const big&a) const{
big c;
c.len=max(len,a.len)+1;
for(int i=0,k=0;i<c.len;i++){
c.s[i]=k*10+s[i]+a.s[i];
k=c.s[i]/10;
c.s[i]%=10;
}
while(c.len>1 && c.s[c.len-1]==0) c.len--;
return c;
}
big operator+=(const big&a){
*this=*this+a;
return *this;
}
big operator*(const big&a) const{
big c;
c.len=len+a.len;
for(int i=0;i<len;i++)
for(int j=0;j<a.len;j++){
c.s[i+j]+=s[i]*a.s[j];
c.s[i+j+1]+=c.s[i+j]/10;
c.s[i+j]%=10;
}
while(c.len>1 && c.s[c.len-1]==0) c.len--;
return c;
}
big operator*=(const big&a){
*this=*this*a;
return *this;
}
big operator/(const int a)const{
big c;
c.len=len;
for(int i=len-1,k=0;i>=0;i--){
c.s[i]=10*k+s[i];
k=c.s[i]%a;
c.s[i]/=a;
}
while(c.len>1 && c.s[c.len-1]==0) c.len--;
return c;
}
big operator/=(const int a){
*this=*this/a;
return *this;
}
bool operator<(const big&a)const{
if(len!=a.len) return len<a.len;
for(int i=len-1;i>=0;i--){
if(s[i]!=a.s[i]) return s[i]<a.s[i];
}
}
bool operator>(const big&a)const{
return a<*this;
}
bool operator<=(const big&a)const{
return !(*this>a);
}
bool operator>=(const big&a)const{
return !(*this<a);
}
bool operator==(const big&a)const{
return !(*this<a) && !(*this>a);
}
bool operator!=(const big&a)const{
return *this<a || *this>a;
}
};
istream& operator>>(istream &in,big &a){
char num[maxn];
in>>num;
a=num;
return in;
}
ostream& operator<<(ostream &out,big &a){
for(int i=a.len-1;i>=0;i--) cout<<a.s[i];
return out;
}
int main(){
big s(10),ss(120);
cin>>s>>ss;
ss*=10;
cout<<ss<<endl;
return 0;
}
<span style="font-size:24px;">下面是压位(4位)的程序:</span>
<span style="font-size:24px;"></span><pre name="code" class="cpp">#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
const int maxn=1000;
struct big
{
int len,s[maxn];
big(){memset(s,0,sizeof(s)); len=1;}
big operator=(const char *num)
{
len=strlen(num);
memset(s,0,sizeof(s));
for(int i=0;i<len;i++) s[(len-i-1)/4]=s[(len-i-1)/4]*10+num[i]-'0';
len=len/4+1;
if(len>1 && s[len-1]==0) len--;
return *this;
}
big operator=(const long long num)
{
char a[maxn];
sprintf(a,"%d",num);
*this=a;
return *this;
}
big (const long long num)
{
*this=num;
}
big (const char *num)
{
*this=num;
}
big operator+(big &a)
{
big c;
c.len=max(len,a.len)+1;
for(int i=0,x=0;i<c.len;i++)
{
c.s[i]=s[i]+a.s[i]+x;
x=c.s[i]/10000;
c.s[i]%=10000;
}
if(c.len>1 && c.s[c.len-1]==0) c.len--;
return c;
}
big operator+=(big &a)
{
*this=*this+a;
return *this;
}
big operator*(const big &a) const
{
big c;
c.len=len+a.len;
for(int i=0;i<len;i++)
for(int j=0;j<a.len;j++)
{
c.s[i+j]+=s[i]*a.s[j];
c.s[i+j+1]+=c.s[i+j]/10000;
c.s[i+j]%=10000;
}
if(c.len>1 && c.s[c.len-1]==0) c.len--;
return c;
}
big operator*=(const big &a)
{
*this=*this*a;
return *this;
}
big operator/(int a)
{
big c;
c.len=len;
for(int i=len-1,k=0;i>=0;i--)
{
c.s[i]=10000*k+s[i];
k=c.s[i]%a;
c.s[i]/=a;
}
while(c.len>1 && c.s[c.len-1]==0) c.len--;
return c;
}
big operator/=(int a)
{
*this=*this/a;
return *this;
}
bool operator<(big a)
{
if(len!=a.len) return len<a.len;
for(int i=len-1;i>=0;i--)
if(s[i]!=a.s[i]) return s[i]<a.s[i];
return 0;
}
bool operator>(big a)
{
return a<*this;
}
bool operator<=(big a)
{
return !(*this>a);
}
bool operator>=(big a)
{
return !(*this<a);
}
bool operator==(big a)
{
return *this<=a && *this>=a;
}
bool operator!=(big a)
{
return !(*this==a);
}
};
istream &operator>>(istream &in,big &a)
{
char num[maxn];
in>>num;
a=num;
return in;
}
ostream &operator<<(ostream &out,big a)
{
cout<<a.s[a.len-1];
for(int i=a.len-2;i>=0;i--)
{
if(a.s[i]<1000) cout<<"0";
<span style="white-space:pre"> </span>if(a.s[i]<100) cout<<"0";
<span style="white-space:pre"> </span>if(a.s[i]<10) cout<<"0";
<span style="white-space:pre"> </span>cout<<a.s[i];
}
return out;
}
int main()
{
int n;
big ss,sss;
cin>>ss>>sss;
// cin>>n;
/* for(int i=1;i<=n;i++)
{
ss=ss*i;
}
cout<<ss<<endl;
*/
ss=ss*sss;
cout<<ss<<endl;
return 0;
}