- C++
11111111111
- @ 2026-7-26 19:24:49
#include<bits/stdc++.h>
using namespace std;
int main(){
char a[1001],b[1001];
int m;
cin >> a >> b >> m;
int la=strlen(a),lb=strlen(b);
int a1[1001]={},b1[1001]={};
for(int i=0;i<la;i++){
a1[la-1-i]=a[i]-48;
}
for(int i=0;i<lb;i++){
b1[lb-1-i]=b[i]-48;
}
int c1[2001]={};
int x=0;
for(int i=0;i<lb;i++){
for(int j=0;j<la;j++){
c1[j+i] += a1[j]*b1[i] + x;
x = c1[j+i]/10;
c1[j+i] %= 10;
}
c1[i+la] = x;
x = 0;
}
int lc=la+lb-1;
if(c1[lc]!=0){
lc++;
}
int cnt = 0;
for(int i = lc - 1; i >= 0; i--){
if(c1[i] == m){
cnt++;
}
}
cout << cnt << endl;
return 0;
}
0 comments
No comments so far...