13 条题解
-
0
#include #include <math.h> #include #include <stdio.h> #include #include #include #include <string.h> #include using namespace std; #define LL long long const int N = 1e6 + 10; const int INF = 0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin >> a; cin >> b; lena = a.size(); lenb = b.size();
}
-
0
#include #include #include #include #include #include #include using namespace std; const int N =1e5+10; string a , b; int lena , lenb , lenc , a1[N] , b1[N] , c1[N] , x; int main() { cin>>a>>b; lena = a.size(); lenb = b.size(); for(int i = 1;i <= lena;i++) { a1[i] = a[lena - i] - '0'; } for(int i = 1;i <= lenb;i++) { b1[i] = b[lenb - i] - '0'; } for(int i = 1;i <= lenb;i++) { x = 0; for(int j = 1;j<= lena;j++) { c1[i + j - 1] += a1[j] * b1[i] + x; x = c1[i + j - 1] / 10; c1[i + j - 1] %= 10; } c1[i + lena] = x; } lenc = lena + lenb; while(c1[lenc] == 0 && lenc > 1) { lenc--; } for(int i = lenc;i >= 1;i--) { cout<<c1[i]; } return 0; }
-
[ ] > ````````````````````````````````````````````````````````````````````````````````````````````````**************
-
-
0
#include #include <math.h> #include #include <stdio.h> #include #include #include #include <string.h> #include using namespace std; const int N=1e5+10; const int INF=0x3f3f3f3f; char a[N],b[N]; int a1[N],b1[N],c1[N],lenc,x; int main(){ cin>>a>>b; int lena=strlen(a); int lenb=strlen(b); for(int i=0;i<lena;i++) a1[i]=a[lena-i-1]-'0'; for(int j=0;j<lenb;j++) b1[j]=b[lenb-j-1]-'0';
}
-
-1
#include using namespace std; #define ll long long const int N =1e5+10; const int INF =0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;i++) { a1[i]=a[lena-i-1]-'0'; } for(int i=0;i<lenb;i++) { b1[i]=b[lenb-i-1]-'0'; } for(int i=0;i<lenb;i++) { x=0; for(int j=0;j<lena;j++) { c1[i+j]+=a1[j]*b1[i]+x; x=c1[i+j]/10; c1[i+j]%=10; } c1[lena+i]=x; } lenc=lena+lenb; while(c1[lenc]==0&&lenc>0) { lenc--; } for(int i=lenc;i>=0;i--) { cout<<c1[i]; } return 0; } #include using namespace std; #define ll long long const int N =1e5+10; const int INF =0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;i++) { a1[i]=a[lena-i-1]-'0'; } for(int i=0;i<lenb;i++) { b1[i]=b[lenb-i-1]-'0'; } for(int i=0;i<lenb;i++) { x=0; for(int j=0;j<lena;j++) { c1[i+j]+=a1[j]*b1[i]+x; x=c1[i+j]/10; c1[i+j]%=10; } c1[lena+i]=x; } lenc=lena+lenb; while(c1[lenc]==0&&lenc>0) { lenc--; } for(int i=lenc;i>=0;i--) { cout<<c1[i]; } return 0; } #include using namespace std; #define ll long long const int N =1e5+10; const int INF =0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;i++) { a1[i]=a[lena-i-1]-'0'; } for(int i=0;i<lenb;i++) { b1[i]=b[lenb-i-1]-'0'; } for(int i=0;i<lenb;i++) { x=0; for(int j=0;j<lena;j++) { c1[i+j]+=a1[j]*b1[i]+x; x=c1[i+j]/10; c1[i+j]%=10; } c1[lena+i]=x; } lenc=lena+lenb; while(c1[lenc]==0&&lenc>0) { lenc--; } for(int i=lenc;i>=0;i--) { cout<<c1[i]; } return 0; } #include using namespace std; #define ll long long const int N =1e5+10; const int INF =0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;i++) { a1[i]=a[lena-i-1]-'0'; } for(int i=0;i<lenb;i++) { b1[i]=b[lenb-i-1]-'0'; } for(int i=0;i<lenb;i++) { x=0; for(int j=0;j<lena;j++) { c1[i+j]+=a1[j]*b1[i]+x; x=c1[i+j]/10; c1[i+j]%=10; } c1[lena+i]=x; } lenc=lena+lenb; while(c1[lenc]==0&&lenc>0) { lenc--; } for(int i=lenc;i>=0;i--) { cout<<c1[i]; } return 0; } #include using namespace std; #define ll long long const int N =1e5+10; const int INF =0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;i++) { a1[i]=a[lena-i-1]-'0'; } for(int i=0;i<lenb;i++) { b1[i]=b[lenb-i-1]-'0'; } for(int i=0;i<lenb;i++) { x=0; for(int j=0;j<lena;j++) { c1[i+j]+=a1[j]*b1[i]+x; x=c1[i+j]/10; c1[i+j]%=10; } c1[lena+i]=x; } lenc=lena+lenb; while(c1[lenc]==0&&lenc>0) { lenc--; } for(int i=lenc;i>=0;i--) { cout<<c1[i]; } return 0; } #include using namespace std; #define ll long long const int N =1e5+10; const int INF =0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;i++) { a1[i]=a[lena-i-1]-'0'; } for(int i=0;i<lenb;i++) { b1[i]=b[lenb-i-1]-'0'; } for(int i=0;i<lenb;i++) { x=0; for(int j=0;j<lena;j++) { c1[i+j]+=a1[j]*b1[i]+x; x=c1[i+j]/10; c1[i+j]%=10; } c1[lena+i]=x; } lenc=lena+lenb; while(c1[lenc]==0&&lenc>0) { lenc--; } for(int i=lenc;i>=0;i--) { cout<<c1[i]; } return 0; } #include using namespace std; #define ll long long const int N =1e5+10; const int INF =0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;i++) { a1[i]=a[lena-i-1]-'0'; } for(int i=0;i<lenb;i++) { b1[i]=b[lenb-i-1]-'0'; } for(int i=0;i<lenb;i++) { x=0; for(int j=0;j<lena;j++) { c1[i+j]+=a1[j]*b1[i]+x; x=c1[i+j]/10; c1[i+j]%=10; } c1[lena+i]=x; } lenc=lena+lenb; while(c1[lenc]==0&&lenc>0) { lenc--; } for(int i=lenc;i>=0;i--) { cout<<c1[i]; } return 0; } #include using namespace std; #define ll long long const int N =1e5+10; const int INF =0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;i++) { a1[i]=a[lena-i-1]-'0'; } for(int i=0;i<lenb;i++) { b1[i]=b[lenb-i-1]-'0'; } for(int i=0;i<lenb;i++) { x=0; for(int j=0;j<lena;j++) { c1[i+j]+=a1[j]*b1[i]+x; x=c1[i+j]/10; c1[i+j]%=10; } c1[lena+i]=x; } lenc=lena+lenb; while(c1[lenc]==0&&lenc>0) { lenc--; } for(int i=lenc;i>=0;i--) { cout<<c1[i]; } return 0; } #include using namespace std; #define ll long long const int N =1e5+10; const int INF =0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;i++) { a1[i]=a[lena-i-1]-'0'; } for(int i=0;i<lenb;i++) { b1[i]=b[lenb-i-1]-'0'; } for(int i=0;i<lenb;i++) { x=0; for(int j=0;j<lena;j++) { c1[i+j]+=a1[j]*b1[i]+x; x=c1[i+j]/10; c1[i+j]%=10; } c1[lena+i]=x; } lenc=lena+lenb; while(c1[lenc]==0&&lenc>0) { lenc--; } for(int i=lenc;i>=0;i--) { cout<<c1[i]; } return 0; } #include using namespace std; #define ll long long const int N =1e5+10; const int INF =0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;i++) { a1[i]=a[lena-i-1]-'0'; } for(int i=0;i<lenb;i++) { b1[i]=b[lenb-i-1]-'0'; } for(int i=0;i<lenb;i++) { x=0; for(int j=0;j<lena;j++) { c1[i+j]+=a1[j]*b1[i]+x; x=c1[i+j]/10; c1[i+j]%=10; } c1[lena+i]=x; } lenc=lena+lenb; while(c1[lenc]==0&&lenc>0) { lenc--; } for(int i=lenc;i>=0;i--) { cout<<c1[i]; } return 0; } #include using namespace std; #define ll long long const int N =1e5+10; const int INF =0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;i++) { a1[i]=a[lena-i-1]-'0'; } for(int i=0;i<lenb;i++) { b1[i]=b[lenb-i-1]-'0'; } for(int i=0;i<lenb;i++) { x=0; for(int j=0;j<lena;j++) { c1[i+j]+=a1[j]*b1[i]+x; x=c1[i+j]/10; c1[i+j]%=10; } c1[lena+i]=x; } lenc=lena+lenb; while(c1[lenc]==0&&lenc>0) { lenc--; } for(int i=lenc;i>=0;i--) { cout<<c1[i]; } return 0; } #include using namespace std; #define ll long long const int N =1e5+10; const int INF =0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;i++) { a1[i]=a[lena-i-1]-'0'; } for(int i=0;i<lenb;i++) { b1[i]=b[lenb-i-1]-'0'; } for(int i=0;i<lenb;i++) { x=0; for(int j=0;j<lena;j++) { c1[i+j]+=a1[j]*b1[i]+x; x=c1[i+j]/10; c1[i+j]%=10; } c1[lena+i]=x; } lenc=lena+lenb; while(c1[lenc]==0&&lenc>0) { lenc--; } for(int i=lenc;i>=0;i--) { cout<<c1[i]; } return 0; } #include using namespace std; #define ll long long const int N =1e5+10; const int INF =0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;i++) { a1[i]=a[lena-i-1]-'0'; } for(int i=0;i<lenb;i++) { b1[i]=b[lenb-i-1]-'0'; } for(int i=0;i<lenb;i++) { x=0; for(int j=0;j<lena;j++) { c1[i+j]+=a1[j]*b1[i]+x; x=c1[i+j]/10; c1[i+j]%=10; } c1[lena+i]=x; } lenc=lena+lenb; while(c1[lenc]==0&&lenc>0) { lenc--; } for(int i=lenc;i>=0;i--) { cout<<c1[i]; } return 0; } #include using namespace std; #define ll long long const int N =1e5+10; const int INF =0x3f3f3f3f; string a,b; int a1[N],b1[N],c1[N],lena,lenb,lenc,x; int main() { cin>>a>>b; lena=a.size(); lenb=b.size(); for(int i=0;i<lena;i++) { a1[i]=a[lena-i-1]-'0'; } for(int i=0;i<lenb;i++) { b1[i]=b[lenb-i-1]-'0'; } for(int i=0;i<lenb;i++) { x=0; for(int j=0;j<lena;j++) { c1[i+j]+=a1[j]*b1[i]+x; x=c1[i+j]/10; c1[i+j]%=10; } c1[lena+i]=x; } lenc=lena+lenb; while(c1[lenc]==0&&lenc>0) { lenc--; } for(int i=lenc;i>=0;i--) { cout<<c1[i]; } return 0; }
- 1
信息
- ID
- 1187
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 6
- 标签
- 递交数
- 678
- 已通过
- 208
- 上传者