Cow Multiplication
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 13312   Accepted: 9307

Description

Bessie is tired of multiplying pairs of numbers the usual way, so she invented her own style of multiplication. In her style, A*B is equal to the sum of all possible pairwise products between the digits of A and B. For example, the product 123*45 is equal to 1*4 + 1*5 + 2*4 + 2*5 + 3*4 + 3*5 = 54. Given two integers A and B (1 ≤ A, B ≤ 1,000,000,000), determine A*B in Bessie's style of multiplication.

Input

* Line 1: Two space-separated integers: A and B.

Output

* Line 1: A single line that is the A*B in Bessie's style of multiplication.

Sample Input

123 45

Sample Output

54

Source

分析:算是处理字符串吧!用两个数组去做,用一个数去计算它们的和即可!
下面给出AC代码:
 #include <algorithm>
#include <cstring>
#include <cstdio>
#include <iostream>
using namespace std;
int main()
{
char a[],b[];
int c[];
while(scanf("%s%s",&a,&b)!=EOF)
{
memset(c,,sizeof(c));
int s=;
int lena=strlen(a);
int lenb=strlen(b);
for(int i=;i<lena;i++)
{
for(int j=;j<lenb;j++)
{
c[i]=(int)(a[i]-'')*(int)(b[j]-'');
s+=c[i];
}
}
cout<<s<<endl;
}
return ;
}

POJ 3673 Cow Multiplication的更多相关文章

  1. POJ 3673 Cow Multiplication (水题)

    题意:给你两个数,求所有的数位的积的和. 析:太水了,没的说,可以先输入边算,也可以最后再算,一样.. 代码如下: #include <cstdio> #include <strin ...

  2. POJ 3673:Cow Multiplication

    Cow Multiplication Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12210   Accepted: 85 ...

  3. POJ 3045 Cow Acrobats (贪心)

    POJ 3045 Cow Acrobats 这是个贪心的题目,和网上的很多题解略有不同,我的贪心是从最下层开始,每次找到能使该层的牛的风险最小的方案, 记录风险值,上移一层,继续贪心. 最后从遍历每一 ...

  4. poj 3348 Cow 凸包面积

    Cows Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 8122   Accepted: 3674 Description ...

  5. POJ 3660 Cow Contest / HUST 1037 Cow Contest / HRBUST 1018 Cow Contest(图论,传递闭包)

    POJ 3660 Cow Contest / HUST 1037 Cow Contest / HRBUST 1018 Cow Contest(图论,传递闭包) Description N (1 ≤ N ...

  6. POJ 3176 Cow Bowling(dp)

    POJ 3176 Cow Bowling 题目简化即为从一个三角形数列的顶端沿对角线走到底端,所取得的和最大值 7 * 3 8 * 8 1 0 * 2 7 4 4 * 4 5 2 6 5 该走法即为最 ...

  7. POJ 2184 Cow Exhibition【01背包+负数(经典)】

    POJ-2184 [题意]: 有n头牛,每头牛有自己的聪明值和幽默值,选出几头牛使得选出牛的聪明值总和大于0.幽默值总和大于0,求聪明值和幽默值总和相加最大为多少. [分析]:变种的01背包,可以把幽 ...

  8. POJ 2375 Cow Ski Area(强连通)

    POJ 2375 Cow Ski Area id=2375" target="_blank" style="">题目链接 题意:给定一个滑雪场, ...

  9. Poj 3613 Cow Relays (图论)

    Poj 3613 Cow Relays (图论) 题目大意 给出一个无向图,T条边,给出N,S,E,求S到E经过N条边的最短路径长度 理论上讲就是给了有n条边限制的最短路 solution 最一开始想 ...

随机推荐

  1. SSH连接工具:SecureCRT设置,另一个SSH连接工具:Xshell。在Windows和Linux之间互传文件可用WinSCP

    一般Linux发行版不允许root远程登录,CentOS允许. 调整字体大小:

  2. Google Chrome谷歌/火狐/Safari浏览器开发者工具基本使用教程

    前言 在阅读下面内容之前,那么些简单的了解浏览器开发者工具到底是什么东西,到底有什么用途. 浏览器开发者工具到底是什么? 其实简单的说,浏览器开发者工具就是给专业的web应用和网站开发人员使用的工具, ...

  3. ABP-Module

    [TOC] 什么是Module? Module就是模块化的设计思想.开发人员可以将自定义的功能以模块的形式集成到项目中.具体的功能也可以设计成一个单独的模块 AbpModule AbpModule是所 ...

  4. PHP随机函数【上】

    随机函数应用的场景很多,比如验证码,token,订单号等.由浅入深了解常用随机函数 1.rand 常用的随机数字函数,默认生成[0,getrandmax()]之间的随机数(包括边界值),因性能问题已被 ...

  5. php程序员面试经验

    面试是你进入公司的第一个关卡,面试过后还会有试用期.可有时候总有那么一些人对待面试完全没人任何防备. 如果你想进入一家优秀的企业,那么对于面试你一定要做好十足的准备.为什么说了:"将军不打没 ...

  6. Ubuntu中启用ssh服务---转载

    ssh程序分为有客户端程序openssh-client和服务端程序openssh-server.如果需要ssh登陆到别的电脑,需要安装openssh-client,该程序Ubuntu是默认安装的.而如 ...

  7. 腾讯云主机 MySQL 远程访问配置方法

    使用腾讯云主机安装 MySQL 之后,需要通过以下步骤进行配置以实现远程访问,主要分为两大部分 一.服务器端口配置 1.如果你的云主机配置了安全组,如果没有配置安全组就可以直接跳过“步骤1”的操作,否 ...

  8. locust 参数,数据详解

    参数    说明-h, –help    查看帮助-H HOST, –host=HOST    指定被测试的主机,采用以格式:http://10.21.32.33–web-host=WEB_HOST  ...

  9. Oracle学习笔记_09_字符串相关函数

    二.参考资料 0.Oracle中的字符串类型及相关函数详解 1.ORACLE 字符串操作 2.oracle函数大全-字符串处理函数

  10. Xamarin.android Activity动画切换效果实现

    http://blog.csdn.net/esunshine1985/article/details/44302903 1.在Resources--values下新建styles.xml,添加内容如下 ...