前三章
https://blog.csdn.net/weixin_42114379/article/details/82219871
全
https://blog.csdn.net/fantasydreams/article/details/78991140?utm_source=blogxgwz6
或者
https://blog.csdn.net/qq_36502291/article/details/82079337
1906 Problem C 特殊乘法
while(cin>>s1>>s2) {
int x=0;
for(int i=0;i<s1.length();i++)
{
for(int j=0;j<s2.length();j++)
x+=(s1[i]-'0')*(s2[j]-'0');
}
cout<<x<<endl; }
1808 Problem C 字符串的查找删除
1962 Problem D 单词替换
#include<iostream>
#include<string>
using namespace std;
int main()
{
string s,s1,s2;
while(getline(cin,s),getline(cin,s1),getline(cin,s2))
{
while(s.find(s1)!=string::npos)
{
s.replace(s.find(s1),1,s2);
}
cout<<s<<endl;
}
}
1963 Problem E 字符串去特定字符
while(getline(cin,s),getline(cin,s1))
{
while(s.find(s1)!=string::npos)
{
s.erase(s.find(s1),1);
}
2080问题 H:
整数奇偶排序 在不知道每行个数的情况下 输入未知组数据
int x;
while(scanf("%d",&x)!=EOF)
{ int a[1000];a[0]=x; int i=1;
while(cin>>a[i++]&&getchar()!=’\n’) {;}
for(int k=0;k<i;k++) { cout<<a[k]<<" "; } cout<<endl; }