1
#include<bits/stdc++.h>
#define il inline
#define ri register
#define ll long long
using namespace std;
struct lll{
int num[1001];
lll(){num[0]=1;}
il void clear(){
memset(num,0,sizeof(num)),num[0]=1;
}
il void read(){
string s;cin>>s,num[0]=s.size();
for(ri int i(1);i<=num[0];++i)
num[i]=s[num[0]-i];
}
il void print(){
for(ri int i(num[0]);i;--i)putchar(num[i]+48);
}
il void operator=(string s){
num[0]=s.size();
for(ri int i(1);i<=s.size();++i)
num[i]=num[s.size()-i];
}
il lll operator+(lll x){
lll y;y.clear();ri int i;
for(i=1;i<=num[0]||i<=x.num[0];++i){
y.num[i]+=num[i]+x.num[i];
if(y.num[i]>9)++y.num[i+1],y.num[i]-=10;
}y.num[0]=i;
while(!y.num[y.num[0]]&&y.num[0]>1)--y.num[0];
return y;
}
il lll operator-(lll x){
lll y;y.clear();ri int i;
for(i=1;i<=num[0];++i){
y.num[i]+=num[i]-x.num[i];
if(y.num[i]<0)--y.num[i+1],y.num[i]+=10;
}y.num[0]=i;
while(!y.num[y.num[0]]&&y.num[0]>1)--y.num[0];
return y;
}
il lll operator*(lll x){
lll y;y.clear();ri int i,j,k;
for(i=1;i<=num[0];++i){
k=0;
for(j=1;j<=x.num[0];++j)
y.num[i+j-1]+=num[i]*x.num[j]+k,
k=y.num[i+j-1]/10,y.num[i+j-1]%=10;
y.num[i+x.num[0]]+=k;
}y.num[0]=i+j;
while(!y.num[y.num[0]]&&y.num[0]>1)--y.num[0];
return y;
}
}fact[2501],c[51][51],f[51];
int main(){
return 0;
}
2
#include<bits/stdc++.h>
using namespace std;
char b[20005],m[11011]={"1"},w[11011],ww[100000]={"1"};
char ci[11101],cou[11011],op[10111],cnt[10111],os[11011],ok[1111];
void jia(char m[],char n[]){
int len=0,op=0;
int a[24090]={},b[24009]={},c[20049]={};
char o[24009]={};
int lenm=strlen(m);
int lenn=strlen(n);
for (int i=1;i<=lenm;i++){
a[i]=m[lenm-i]-'0';
}
for (int i=1;i<=lenn;i++){
b[i]=n[lenn-i]-'0';
}
len++;
op=0;
while(len<=lenm||len<=lenn){
c[len]=a[len]+b[len]+op;
op=c[len]/10;
c[len]%=10;
len++;
}
if (c[len+1]>0) len++;
else c[len]=op;
if (c[len]==0) len--;
for (int i=1;i<=len;i++){
o[i-1]=c[len+1-i]+'0';
}
strcpy(m,o);
return;
}
void c(char s1[],char s2[]){
int a[100000]={},b[100000]={},c[100000]={};;
int len1=strlen(s1);
int len2=strlen(s2);
char s[100000]={};
for(int i=1;i<=len1;i++)a[i]=s1[len1-i]-'0';
for(int i=1;i<=len2;i++)b[i]=s2[len2-i]-'0';
for(int i=1;i<=len1;i++){
for(int j=1;j<=len2;j++){
c[i+j-1]+=a[i]*b[j];
c[i+j]+=c[i+j-1]/10;
c[i+j-1]%=10;
}
}
int len3=len1+len2;
while(len3>1&&c[len3]==0)len3--;
for(int i=1;i<=len3;i++){
s[i-1]=c[len3+1-i]+'0';
}
strcpy(s1,s);
return;
}
bool cmp(char x[],char y[]){
int a=strlen(x);
int b=strlen(y);
if(a>b)return true;
if(a==b&&strcmp(x,y)>0)return true;
return false;
}
void jian(char s1[], char s2[]){
int a[11111]={},b[11111]={},c[11111]={};
int len1=strlen(s1);
int len2=strlen(s2);
char s[10000]={};
len1=strlen(s1);
len2=strlen(s2);
for(int i=1;i<=len1;i++)a[i]=s1[len1-i]-'0';
for(int i=1;i<=len2;i++)b[i]=s2[len2-i]-'0';
int len3=max(len1,len2);
for(int i=1;i<=len3;i++){
c[i]+=a[i]-b[i];
if(c[i]<0){
c[i+1]--;
c[i]+=10;
}
}
while(len3>1 && c[len3]==0)len3--;
for(int i=1;i<=len3;i++)s[i-1]=c[len3+1-i]+'0';
strcpy(s1,s);
return;
}
void chu(char s1[],char s2[]){
b[0]='1';
for(int i=1;i<=200;i++)b[i]='0';
strcpy(op,s2);
for(int i=200;i>=0;i--){
while(cmp(s1,os)){
jia(cnt,b);
c(s2,cnt);
strcpy(os,s2);
strcpy(s2,op);
}
jian(cnt,b);
b[i]='\0';
strcpy(os,ok);
}
jia(m,cnt);strcpy(w,m);c(w,s2);
if(!strcmp(w,s1))strcpy(s1,m);
else strcpy(s1,cnt);
return;
}
int main(){
return 0;
}
标签:return,int,s2,char,num,高精,lll
From: https://www.cnblogs.com/houburzyx/p/18248328