Pku3673
<span style="color:#6600cc;">/*
B - Cow Multiplication
Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Submit Status Practice POJ 3673
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
By Grant Yuan
2014.7.11
*/
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
using namespace std;
int main()
{
int sum=0;
char a[13],b[13];
memset(a,0,12);
memset(b,0,12); cin>>a>>b;
int i,j;
int o,q;
o=strlen(a);
q=strlen(b); int n1,n2;
for(i=0;i<o;i++)
for(j=0;j<q;j++)
{
n1=a[i]-48;
n2=b[j]-48;
sum+=n1*n2;
}
cout<<sum<<endl;
return 0; } </span>
Pku3673的更多相关文章
随机推荐
- Sql语句-case when then else end
依据上面的表信息输出以下的结果: 以下是建库和表结构据: create table DeptSales ( deptID int, SubjMonth int , sales int , deptna ...
- python接口自动化16-multipart/form-data上传图片
前言 在提交表单操作的时候,经常会遇到图片上传的操作,图片上传是一个单独的接口,本篇以禅道为例,介绍如何上传图片 上传接口 1.以禅道上提交bug为例,在选择图片时,点确定按钮,就是上传图片了 2.用 ...
- maven添加本地非repository中的jar包
1.今天在使用maven编译打包一个web应用的时候,碰到一个问题: 项目在开发是引入了依赖jar包,放在了WEB-INF/lib目录下,并通过buildpath中将web libariary导入. ...
- jquery显示、隐藏div的方法
$("#top_notice").css("display", "block");//第1种方法 //$("#top_notice ...
- linux 编译win32程序
apt-get install mingw32 int main(int argc, char *argv) { printf("Windows Compiler Test\n") ...
- 数学图形(2.26) 3D曲线结
我收集的几种曲线结 knot(huit) #http://www.mathcurve.com/courbes3d/noeuds/noeudenhuit.shtml vertices = 1000 t ...
- 深度Linux Deepin系统安装教程使用体验
很早以前,试用过一次深度的OS,那时深度刚出自己的Linux修改版系统,过了有两年了,准备看看Deepin OS有什么变化,和雨林木风的Start OS比,有什么不同 1.安装的引导菜单和Start ...
- 使用WebView出现web page not available
很有可能是没有设置权限,所以不能浏览相应的URL,设置如下: 在AndroidManifest.xml中添加 <uses-permission android:name="androi ...
- JDK 1.7版本的 新特性
摘自: http://yanguz123.iteye.com/blog/1934766 Jdk1.7的新特性: 1,switch中可以使用字串 Java代码: String s = "tes ...
- Nodejs 天涯帖子《鹿鼎记中计》 柳成萌著 下载爬虫
功能:从天涯帖子中下载楼主发言到一个文本文件中 实验对象:http://bbs.tianya.cn/post-no05-308123-1.shtml <鹿鼎记中计> 柳成萌著 爬取效果: ...