文章

28

粉丝

230

获赞

23

访问

230.4k

头像
字符化处理:注意用str-'0'转换回数字
P1168 清华大学上机题
发布于2021年3月10日 23:42
阅读数 7.8k

#include <iostream>
#include <string>

using namespace std;

int main(int argc, char const *argv[])
{
	string str1,str2;
	while(cin>>str1>>str2){
            long long Sum = 0 ;
		for (int i = 0; i < str1.length(); ++i)
		{
			for (int j = 0; j < str2.length(); ++j)
			{
				Sum+=(str1[i]-'0')*(str2[j]-'0');
			}
		}
    cout<<Sum<<endl;
	}

	return 0;
}

 

登录查看完整内容


登录后发布评论

暂无评论,来抢沙发