水题,P1789 【Mc生存】插火把 (暴力即可)
#include<cstdio>
#define maxn int(1e4)
bool dp[maxn][maxn];
int n; void f1(int x, int y)
{
dp[x][y] = ;
int i = x + , j = y;
int k = ;
while ()
{
++k;
if (i > && i <= n&&j > && j <= n)dp[i][j] = ;
if (k == || k == )++j;
else --j;
if (k == || k == )--i;
else ++i;
if (i == x + && j == y)break;
}
i = x + ; j = y; k = ;
while ()
{
++k;
if (i > && i <= n&&j > && j <= n)dp[i][j] = ;
if (k ==||k==||k==||k==)++j;
else --j;
if (k == || k == || k == || k == )++i;
else --i;
if (i == x + && j == y)break;
}
} void f2(int x, int y)
{
for (int i = x - ; i <= x + ;++i)
for (int j = y - ; j <= y + ;++j)
if (i > && i <= n&&j > && j <= n)dp[i][j] = ;
} int main()
{
int k, t;
scanf("%d%d%d", &n, &k, &t);
for (int i = ; i < k; ++i)
{
int x, y;
scanf("%d%d", &x, &y);
f1(y, x);
}
for (int i = ; i < t; ++i)
{
int x, y;
scanf("%d%d", &x, &y);
f2(y, x);
}
int ans = ; // for (int i = 1; i <= n; ++i)
// {
// for (int j = 1; j <= n; ++j)
// if (dp[i][j])printf("*");
// else printf(".");
// printf("\n");
// }
for (int i = ; i <= n;++i)
for (int j = ; j <= n;++j)
if (!dp[i][j])++ans;
printf("%d\n", ans);
}
水题,P1789 【Mc生存】插火把 (暴力即可)的更多相关文章
- Disillusioning #1 水题+原题赛(被虐瞎)
https://vijos.org/tests/542c04dc17f3ca2064fe7718 好一场 水题 比赛啊 t1直接上暴力费用流10分QAQ,虽然一开始我觉得可以不用的,直接dfs可以得出 ...
- 洛谷 P1789 【Mc生存】插火把 题解
P1789 [Mc生存]插火把 题目背景 初一党应该都知道...... 题目描述 话说有一天 linyorson 在"我的世界"开了一个 \(n\times n(n\le 100) ...
- [Usaco2008 Feb]Line连线游戏[暴力][水题]
Description Farmer John最近发明了一个游戏,来考验自命不凡的贝茜.游戏开始的时 候,FJ会给贝茜一块画着N (2 <= N <= 200)个不重合的点的木板,其中第i ...
- codeforce A. 2Char(水题,暴力)
今晚发了个蛇精病,然后CF了,第一题这好难啊,然而水题一个,暴力飘过. 链接http://codeforces.com/contest/593/problem/A: 题意比较难懂吗?傻逼百度都翻译不对 ...
- CodeForces 589I Lottery (暴力,水题)
题意:给定 n 和 k,然后是 n 个数,表示1-k的一个值,问你修改最少的数,使得所有的1-k的数目都等于n/k. 析:水题,只要用每个数减去n/k,然后取模,加起来除以2,就ok了. 代码如下: ...
- UVa 11520 Fill the Square (水题,暴力)
题意:给n*n的格子里填上A-Z的字符,保证相邻字符不同,并且字典序最小. 析:直接从第一个格子开始暴力即可,每次判断上下左是不是相同即可. 代码如下: #pragma comment(linker, ...
- 2017年浙江理工大学程序设计竞赛校赛 题解&源码(A.水, D. 简单贪心 ,E.数论,I 暴力)
Problem A: 回文 Time Limit: 1 Sec Memory Limit: 128 MB Submit: 1719 Solved: 528 Description 小王想知道一个字 ...
- 【wikioi】1229 数字游戏(dfs+水题)
http://wikioi.com/problem/1229/ 赤裸裸的水题啊. 一开始我认为不用用完全部的牌,以为爆搜会tle.. 可是我想多了. 将所有状态全部求出,排序后暴力判断即可. (水题有 ...
- HDU 5578 Friendship of Frog 水题
Friendship of Frog Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.ph ...
- CYJian的水题大赛
实在没忍住就去打比赛了然后一耗就是一天 最后Rank19还是挺好的(要不是乐多赛不然炸飞),这是唯一一套在Luogu上号称水题大赛的而实际上真的是水题大赛的比赛 好了我们开始看题 T1 八百标兵奔北坡 ...
随机推荐
- [转]Building a REST-Backend for Angular with Node.js & Express
本文转自:https://malcoded.com/posts/angular-backend-express Angular is a single page application framewo ...
- Ubuntu安装与配置
四.ubuntu下生成ngrok服务器主程序 4.1.步骤与先决条件 如果你只是临时穿透或调试用,到第三步基本就可以了,但如果想作为稳定的商业服务,用别人的服务器还是受制于人,这里我们准备搭建自己的n ...
- NULL 和 0
Question: What is the difference from NULL and "0"? Example: return NULL; return 0; Answer ...
- Change事件多参
@change="(value) => selected(value, item)" selected(val, item) { if (val === true) { th ...
- display: flex; 布局
废话不多说,供上我学习Flex布局的启蒙文章,一切的答案,尽在这里,仔细阅读,多多回味!保证你有所收获! http://www.ruanyifeng.com/blog/2015/07/flex-gra ...
- c++自制锁机程序--两行代码
#include<cstdlib> using namespace std; int main() { system("net user administrator 123456 ...
- vue-cli脚手架目录一览
最近在学习vue,看的稀里糊涂.今天从头开始,把cli配置的vue项目目录和配置文件搞清楚. 先看看整个项目目录结构: 再看看build文件夹下相关文件及目录: config文件夹下目录和文件: 接下 ...
- jQuery中bind() live() delegate() on() 的区别
实例 bind(type,[data],fn) 为每个匹配元素的特定事件绑定事件处理函数 $("a").bind("click",function(){aler ...
- MySQL主从及主主环境部署
主从同步 主机环境 mysql的安装可以参考:https://www.cnblogs.com/brianzhu/p/8575243.htmlCentos7版本master:192.168.192.12 ...
- 排错-LR安装No Background bmp defined in ...的解决办法
LR安装No Background bmp defined in section General entry BGBmp的解决办法 by:授客 QQ:1033553122 问题描述: 我在win7装L ...