题意:给你两个数,求所有的数位的积的和。

析:太水了,没的说,可以先输入边算,也可以最后再算,一样。。

代码如下:

#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
using namespace std ; typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f3f;
const double eps = 1e-8;
const int maxn = 1000 + 5;
const int dr[] = {0, 0, -1, 1};
const int dc[] = {-1, 1, 0, 0};
int m, n;
inline bool is_in(int r, int c){
return r >= 0 && r < n && c >= 0 && c < m;
} int main(){
while(scanf("%d %d", &n, &m) == 2){
int a[15], b[15];
int cnt1 = 0, cnt2 = 0;
while(n){
a[cnt1++] = n % 10;
n /= 10;
}
while(m){
b[cnt2++] = m % 10;
m /= 10;
}
int ans = 0;
for(int i = 0; i < cnt1; ++i)
for(int j = 0; j < cnt2; ++j)
ans += a[i] * b[j];
printf("%d\n", ans);
}
return 0;
}

POJ 3673 Cow Multiplication (水题)的更多相关文章

  1. POJ 3673 Cow Multiplication

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

  2. POJ 1488 Tex Quotes --- 水题

    POJ 1488 题目大意:给定一篇文章,将它的左引号转成 ``(1的左边),右引号转成 ''(两个 ' ) 解题思路:水题,设置一个bool变量标记是左引号还是右引号即可 /* POJ 1488 T ...

  3. POJ 3641 Oulipo KMP 水题

    http://poj.org/problem?id=3461 直接KMP就好.水题 #include<cstdio> #include<cstring> const int M ...

  4. poj 1006:Biorhythms(水题,经典题,中国剩余定理)

    Biorhythms Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 110991   Accepted: 34541 Des ...

  5. poj 1002:487-3279(水题,提高题 / hash)

    487-3279 Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 236746   Accepted: 41288 Descr ...

  6. poj 1003:Hangover(水题,数学模拟)

    Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 99450   Accepted: 48213 Descri ...

  7. poj 2105 IP Address(水题)

    一.Description Suppose you are reading byte streams from any device, representing IP addresses. Your ...

  8. poj 2000 Gold Coins(水题)

    一.Description The king pays his loyal knight in gold coins. On the first day of his service, the kni ...

  9. poj 1035 Spell checker(水题)

    题目:http://poj.org/problem?id=1035 还是暴搜 #include <iostream> #include<cstdio> #include< ...

随机推荐

  1. linux 压缩/解压命令大全

    .tar 解包:tar xvf FileName.tar打包:tar cvf FileName.tar DirName(注:tar是打包,不是压缩!)———————————————.gz解压1:gun ...

  2. log4j配置webapp日志系统

    1.基础知识: Log4j的中文文档 (这是根据最新的log4j(jakarta-log4j-1.2.8)的开发包自带文档的manual翻译的) http://dev.csdn.net/develop ...

  3. WebServices生成发布过程及常见问题的解决方法

    春夏秋冬走健康之路看四季养生网 健康饮食 养生问题 母婴保健 养生小常识 3.下一步,我们需要将Myservice文件夹拷贝到C:\Inetpub\wwwroot目录下(重要).如下图所示  然后依次 ...

  4. How to modify squashfs image

    /********************************************************************** * How to modify squashfs ima ...

  5. 【C#学习笔记】Dictionary容器使用

    using System; using System.Collections.Generic; namespace ConsoleApplication { class Program { stati ...

  6. LeetCode: Binary Tree Level Order Traversal && Binary Tree Zigzag Level Order Traversal

    Title: Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to ...

  7. 最简单的视音频播放示例7:SDL2播放RGB/YUV

    本文记录SDL播放视频的技术.在这里使用的版本是SDL2.实际上SDL本身并不提供视音频播放的功能,它只是封装了视音频播放的底层API.在Windows平台下,SDL封装了Direct3D这类的API ...

  8. Oracle 课程九之绑定变量

    课程目标 完成本课程的学习后,您应该能够: •变量绑定的目的 •父子游标 •游标共享 •绑定窥探 •SQL语句处理流程 •硬解析.软解析.软软解析 •变量绑定的应用场景   1.游标 游标可以理解为S ...

  9. hdu 3948(后缀数组+RMQ)

    题意:求一个串中有多少不同的回文串. 分析:这一题的关键是如何去重,我表示我现在还没理解为什么这样去重,先放这里过两天再看!! //不同回文子串数目 #include <iostream> ...

  10. Activity与Activity之间,Fragment与Fragment之间通过Bundle传值的研究

    一.Fragment与Activity的通讯   在使用fragment的时候,通常的用法都是使用一个activity来管理不同的fragment,所以每个fragment与activity的及时通讯 ...