POJ 3673 Cow Multiplication (水题)
题意:给你两个数,求所有的数位的积的和。
析:太水了,没的说,可以先输入边算,也可以最后再算,一样。。
代码如下:
#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 (水题)的更多相关文章
- POJ 3673 Cow Multiplication
Cow Multiplication Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 13312 Accepted: 93 ...
- POJ 1488 Tex Quotes --- 水题
POJ 1488 题目大意:给定一篇文章,将它的左引号转成 ``(1的左边),右引号转成 ''(两个 ' ) 解题思路:水题,设置一个bool变量标记是左引号还是右引号即可 /* POJ 1488 T ...
- POJ 3641 Oulipo KMP 水题
http://poj.org/problem?id=3461 直接KMP就好.水题 #include<cstdio> #include<cstring> const int M ...
- poj 1006:Biorhythms(水题,经典题,中国剩余定理)
Biorhythms Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 110991 Accepted: 34541 Des ...
- poj 1002:487-3279(水题,提高题 / hash)
487-3279 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 236746 Accepted: 41288 Descr ...
- poj 1003:Hangover(水题,数学模拟)
Hangover Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 99450 Accepted: 48213 Descri ...
- poj 2105 IP Address(水题)
一.Description Suppose you are reading byte streams from any device, representing IP addresses. Your ...
- poj 2000 Gold Coins(水题)
一.Description The king pays his loyal knight in gold coins. On the first day of his service, the kni ...
- poj 1035 Spell checker(水题)
题目:http://poj.org/problem?id=1035 还是暴搜 #include <iostream> #include<cstdio> #include< ...
随机推荐
- linux 压缩/解压命令大全
.tar 解包:tar xvf FileName.tar打包:tar cvf FileName.tar DirName(注:tar是打包,不是压缩!)———————————————.gz解压1:gun ...
- log4j配置webapp日志系统
1.基础知识: Log4j的中文文档 (这是根据最新的log4j(jakarta-log4j-1.2.8)的开发包自带文档的manual翻译的) http://dev.csdn.net/develop ...
- WebServices生成发布过程及常见问题的解决方法
春夏秋冬走健康之路看四季养生网 健康饮食 养生问题 母婴保健 养生小常识 3.下一步,我们需要将Myservice文件夹拷贝到C:\Inetpub\wwwroot目录下(重要).如下图所示 然后依次 ...
- How to modify squashfs image
/********************************************************************** * How to modify squashfs ima ...
- 【C#学习笔记】Dictionary容器使用
using System; using System.Collections.Generic; namespace ConsoleApplication { class Program { stati ...
- 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:SDL2播放RGB/YUV
本文记录SDL播放视频的技术.在这里使用的版本是SDL2.实际上SDL本身并不提供视音频播放的功能,它只是封装了视音频播放的底层API.在Windows平台下,SDL封装了Direct3D这类的API ...
- Oracle 课程九之绑定变量
课程目标 完成本课程的学习后,您应该能够: •变量绑定的目的 •父子游标 •游标共享 •绑定窥探 •SQL语句处理流程 •硬解析.软解析.软软解析 •变量绑定的应用场景 1.游标 游标可以理解为S ...
- hdu 3948(后缀数组+RMQ)
题意:求一个串中有多少不同的回文串. 分析:这一题的关键是如何去重,我表示我现在还没理解为什么这样去重,先放这里过两天再看!! //不同回文子串数目 #include <iostream> ...
- Activity与Activity之间,Fragment与Fragment之间通过Bundle传值的研究
一.Fragment与Activity的通讯 在使用fragment的时候,通常的用法都是使用一个activity来管理不同的fragment,所以每个fragment与activity的及时通讯 ...