<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的更多相关文章

随机推荐

  1. Registering DLL and ActiveX controls from code

    http://delphi.about.com/od/windowsshellapi/l/aa040803a.htm How to register (and unregister) OLE cont ...

  2. How to open a web site with the default web browser in a NEW window

    http://delphi.about.com/cs/adptips2004/a/bltip0504_4.htm When using ShellExecute (as explained in th ...

  3. AskUsingForm_c函数

    IDA SDK里面提供的UI(user interface)函数 AskUsingForm_c,该函数弹出一个对话框,而对话框的外观形式,就由此函数的第一个参数form(const char *类型) ...

  4. Spring MVC - Hello World示例

    以下示例演示如何使用Spring MVC框架编写一个简单的基于Web的Hello World应用程序.首先使用Eclipse IDE,并按照以下步骤使用Spring Web Framework开发一个 ...

  5. 在pycharm中进行nosetests并输出测试报告

    1.首先配置

  6. iOS:下拉刷新控件UIRefreshControl的详解

    下拉刷新控件:UIRefreshControl 1.具体类信息: @interface UIRefreshControl : UIControl //继承控制类 - (instancetype)ini ...

  7. iOS: 转载CoreData数据库框架

    iphone-CoreData的使用详解 一.概念 1.Core Data 是数据持久化存储的最佳方式 2.数据最终的存储类型可以是:SQLite数据库,XML,二进制,内存里,或自定义数据类型 在M ...

  8. go语言基础之格式化输出

    1.fmt包的格式化输出输入 格式说明 格式 含义 %% 一个%字面量 %b 一个二进制整数值(基数为2),或者是一个(高级的)用科学计数法表示的指数为2的浮点数 %c 字符型.可以把输入的数字按照A ...

  9. 统计的一个小题目python实现

    最近面试碰到的一个题目,业余时间用python实现的. 拿到数据,先用sort 命令排序,也可再进一步去重复 sort -k 1,2  data.txt |uniq  > data.new # ...

  10. Redis数据类型--List

    Redis列表是简单的字符串列表,依照插入顺序排序. 你能够加入一个元素到列表的头部(左边)或者尾部(右边) LPUSH 命令插入一个新的元素到头部, RPUSH插入一个新元素到尾部. 当一个这两个操 ...