[CF] 948A Protect Sheep】的更多相关文章

A. Protect Sheep time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided…
http://codeforces.com/contest/948/problem/A   A. Protect Sheep Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his she…
Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus decided to place some shepherd dogs in such a way that all his sheep are protected. The pasture is a rectangle consisting of R × …
题目链接 额..这道题亮点在: $you$ $do$ $not$ $need$ $to$ $minimize$ $their$ $number.$ 所以说嘛... 直接判断狼的四周有没有紧挨着的羊,没有的话,就直接空地全填狗输出.有的话就无解.之后就没了...很暴力... 不过如果你问怎么做才能保证狗最少的话.... 貌似是网络流.反正我不会. #include<iostream> #include<cstdio> #include<algorithm> using n…
[A]Protect Sheep 题意: 一个\(R*C\)的牧场中有一些羊和一些狼,如果狼在羊旁边就会把羊吃掉. 可以在空地上放狗,狼不能通过有狗的地方,狼的行走是四联通的. 问是否能够保护所有的羊不被狼吃掉,如果能输出方案. 题解: 判断是否有羊的旁边有狼,有的话就-1.没有的话把所有空地换成狗就好. #include<bits/stdc++.h> #define F(i,a,b) for(int i=a;i<=(b);++i) #define F2(i,a,b) for(int i…
A. Primal Sport 题意:有两个人轮流玩游戏.给出数X(i-1),轮到的人需要找到一个小于X(i-1)的素数x,然后得到Xi,Xi是x的倍数中大于等于X(i-1)的最小的数.现在已知X2,求最小的X0? 思路:根据题意,X1的取值范围为[X1-X2的最大质因子+1,X2),同理可知X0的取值范围为[X1-X1的最大质因子+1,,X1). #include<iostream> #include<cstring> #include<cstdio> #includ…
A. Protect Sheep time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus dec…
A. Protect Sheep time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Bob is a farmer. He has a large pasture with many sheep. Recently, he has lost some of them due to wolf attacks. He thus dec…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3046 In ZJNU, there is a well-known prairie. And it attracts pleasant sheep and his companions to have a holiday. Big big wolf and his families know about this, and quietly hid in the big lawn. As ZJNU A…
Pleasant sheep and big big wolf Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3316    Accepted Submission(s): 1360 Problem Description In ZJNU, there is a well-known prairie. And it attracts p…