题目:
输入格式:
输出格式:
输入样例1:
3862767 6 13530293 3
输出样例 1:
399
输入样例 2:
3862767 1 13530293 8
输出样例 2:
0
思路总结:
感觉也没啥好写的 qwq
那俺就随便写写吧!!!
咳,咳咳
注意:cin
和scanf
都是读到空格就结束了
strlen()
可以计算字符数组的实际长度
就这样叭!
奥 对喽
还有,
记得加上头文件#include<cstring>
AC代码:
#include<iostream>
#include<cstring>
using namespace std;
int main(){
char s1[110];
char s2;
char s3[110];
char s4;
int a=0,b=0;
scanf("%s",s1);
cin>>s2;
scanf("%s",s3);
cin>>s4;
int len = strlen(s1);
int xxx = strlen(s3);
for(int i =0;i<len;i++)
{
if(s1[i] == s2)
a++;
}
for(int i = 0;i<xxx;i++)
{
if(s3[i] == s4)
b++;
}
int c = s2-'0';
int d = s4-'0';
int x =c;
int y = d;
for(int i = 1;i<a;i++)
{
c = c*10 + x;
}
for (int i = 1;i<b;i++)
{
d = d*10+y;
}
if(a==0) c =0;
if(b==0) d = 0;
cout<<c+d<<endl;
return 0;
}