hdu 4925 Apple Tree--2014 Multi-University Training Contest 6
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4925
Apple Tree
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 188 Accepted Submission(s): 129
For each test case, two integers N, M (1<=N, M<=100) are given in a line, which denote the size of the map.
Statistic | Submit | Discuss | Note
签道题,没啥好说的,黑白染色的方法是最优的,特判1*1的情况
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define CLR(A) memset(A,0,sizeof(A))
int A[110][110];
int main(){int T,m,n;cin>>T;while(T--){cin>>n>>m;if(n==1 && m==1){cout<<1<<endl;continue;}for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)A[i][j]=1;for(int i=1;i<=n;i++)for(int j=1;j<=m;j++){if(A[i][j]==1){A[i-1][j]<<=1;A[i+1][j]<<=1;A[i][j-1]<<=1;A[i][j+1]<<=1;}}long long sum=0;for(int i=1;i<=n;i++)for(int j=1;j<=m;j++){if(A[i][j]!=1){sum+=A[i][j];}}cout<<sum<<endl;}return 0;
}
转载于:https://www.cnblogs.com/wzzkaifa/p/6901870.html
hdu 4925 Apple Tree--2014 Multi-University Training Contest 6相关推荐
- 【HDU 4925】BUPT 2015 newbie practice #2 div2-C-HDU 4925 Apple Tree
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=102419#problem/C Description I've bought an or ...
- HDU 6091 - Rikka with Match | 2017 Multi-University Training Contest 5
思路来自 某FXXL 不过复杂度咋算的.. /* HDU 6091 - Rikka with Match [ 树形DP ] | 2017 Multi-University Training Conte ...
- HDU 6058 - Kanade's sum | 2017 Multi-University Training Contest 3
/* HDU 6058 - Kanade's sum [ 思维,链表 ] | 2017 Multi-University Training Contest 3 题意:给出排列 a[N],求所有区间的第 ...
- 9行代码AC——HDU 6857 -Clockwise or Counterclockwise(2020 Multi-University Training Contest 8)(判断三点顺序)
励志用尽量少的代码做高效表达 Problem Description It is preferrable to read the pdf statment. After some basic geom ...
- HDU 6386 Age of Moyu 2018 Multi-University Training Contest 7(最短路径dijkstra)
Age of Moyu 题意:第一行给出n,m,接下来有m条路,每一行给出 a b c ,从a到b 是c掌控. 若下一条路与上一条路不属于一个c,需要缴费1. 输出从1到N的最小花费,不通则输出-1 ...
- 2018 Multi-University Training Contest 3 Problem F. Grab The Tree 【YY+BFS】
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=6324 Problem F. Grab The Tree Time Limit: 2000/1000 MS ...
- HDU 6638 [2019 Multi-University Training Contest 6]
Snowy Smile Problem Description There are n pirate chests buried in Byteland, labeled by 1,2,-,n. Th ...
- Codeforces Round #417:E. FountainsSagheer and Apple Tree(树上博弈)
Codeforces Round #417:E. FountainsSagheer and Apple Tree(树上博弈) 标签: codeforces 2017-06-02 11:41 29人阅读 ...
- HDU 6051 - If the starlight never fade | 2017 Multi-University Training Contest 2
/* HDU 6051 - If the starlight never fade [ 原根,欧拉函数 ] | 2017 Multi-University Training Contest 2 题意: ...
最新文章
- 小猿圈web前端之jQuery抽奖系统
- 混合云存储开启企业上云新路径--阿里云混合云备份容灾方案发布
- 时间立即同步命令_Redis复制:主从同步
- 网易哲学气质H5看似眼熟,为什么大家还是忍不住转发?
- SQL2012 附加数据库提示5120错误解决方法
- C++第9周(春)项目5 - 一元一次方程类
- disk磁盘管理与Linux驱动编写
- 进程创建函数fork
- MODIS、VIIRS数据下载教程
- 一个一键修改IP设置的BAT脚本
- 网络安全渗透高级工具(黑客工具软件大全100套)
- 名人论数学——数学的本质
- 如何通过网页获取该网站的js框架
- 颠覆虚拟机的神器——WSL来了
- 同花顺模拟炒股软件 v8.40.29 官方版
- Javaweb后端技术(下)02-Mybatis
- openLayers6系列理论基础——Layer数据源source篇
- 表单ajax提交插件,详解javascript表单的Ajax提交插件的使用
- 谢文东的一些话,很有道理
- Putty的安装和使用