<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[dogcat987的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/dogcat987</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; dogcat987]]></copyright><item><title><![CDATA[1~10000000里的回文质数]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/108498675</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/108498675</guid><author>dogcat987</author><pubDate>Wed, 09 Sep 2020 18:37:43 +0800</pubDate><description><![CDATA[5
7
11
101
131
151
181
191
313
353
373
383
727
757
787
797
919
929
10301
10501
10601
11311
11411
12421
12721
12821
13331
13831
13931
14341
14741
15451
15551
16061
16361
16561
16661
17471
17971
18181
18481
19391
19891
19991
30103
30203
30403
30703
30803
310]]></description><category></category></item><item><title><![CDATA[题解洛谷P1074 靶形数独（c++解法）]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/107963413</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/107963413</guid><author>dogcat987</author><pubDate>Wed, 12 Aug 2020 18:00:55 +0800</pubDate><description><![CDATA[#include&lt;iostream&gt;
using namespace std;
int suduku[10][10]={{0,0,0,0,0,0,0,0,0,0},
					{0,1,1,1,2,2,2,3,3,3},
					{0,1,1,1,2,2,2,3,3,3},
					{0,1,1,1,2,2,2,3,3,3},
					{0,4,4,4,5,5,5,6,6,6},
					{0,4,4,4,5,5,5,6,6,6},
					{0,4,4,4,5,5,5,6,6,6},]]></description><category></category></item><item><title><![CDATA[一万以内的质数]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/107230172</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/107230172</guid><author>dogcat987</author><pubDate>Thu, 09 Jul 2020 15:41:55 +0800</pubDate><description><![CDATA[2         3         5         7         11        13        17        19        23        29
31        37        41        43        47        53        59        61        67        71
73        79        83        89        97        101       103       ]]></description><category></category></item><item><title><![CDATA[c++大部分头文件]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/106145074</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/106145074</guid><author>dogcat987</author><pubDate>Fri, 15 May 2020 16:43:43 +0800</pubDate><description><![CDATA[#include&lt;minwindef.h&gt;
#include&lt;queue&gt;
#include&lt;ctype.h&gt;
#include&lt;iostream&gt;
#include&lt;cmath&gt;
#include&lt;windows.h&gt;
#include&lt;conio.h&gt;
#include&lt;time.h&gt;
#include&lt;string&gt;
#include&lt;iomanip&gt;
#include &lt;_m]]></description><category></category></item><item><title><![CDATA[题解洛谷P3406（c++解法）海底地铁]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/106097212</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/106097212</guid><author>dogcat987</author><pubDate>Wed, 13 May 2020 14:19:53 +0800</pubDate><description><![CDATA[对于第i个城市，与第i+1个城市相连的是第ii段铁路。所以任意两个相邻的站点购买同种车票有且仅有一种费用，通过第i段铁路的价格，仅与在第ii个城市和第i+1个城市之间的通过次数有关。若你不是很懂这句话，可以再读一读题目。
那我们不就只需要求某段铁路的通过次数不就ok了？
对于每个区间，用一个循环对其所经次数+1即可。如下代码：
#include &lt;iostream&gt;

using namespace std;

struct railway
{
    int a, b, c;
};

long]]></description><category></category></item><item><title><![CDATA[题解洛谷P5100（c++解法）[JOI 2017 Final]足球]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/106095445</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/106095445</guid><author>dogcat987</author><pubDate>Wed, 13 May 2020 12:24:32 +0800</pubDate><description><![CDATA[此题带球传球控球的状态转换较为复杂，我们可以考虑 拆点 。
首先我们发现最优解一定不会出现一个人重复控球（这个……很容易想到吧）
分析每一个坐标可能出现的状态，分为控球和不控球两种情况
而不控球又分为停留在该坐标和滚动经过该坐标两种情况
而滚动又分为上下左右滚
口胡完毕，总而言之就是一个坐标要拆成六个点（据说可以只拆五个点，但是六个点可能更加便于理解？）
经过简单的分析，我们可以想到用p点的坐标 + k * 场地的点数来表示拆点后的图中某一个点（k为该点的状态序号），可以用x * (w + 1) + y表示]]></description><category></category></item><item><title><![CDATA[题解洛谷CF19A（c++解法）World Football Cup]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/106083361</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/106083361</guid><author>dogcat987</author><pubDate>Tue, 12 May 2020 19:33:20 +0800</pubDate><description><![CDATA[看一下数据，n&lt;=50，也就是可以4层暴力，基本上就是不卡常，让你直接模拟。
作为一个蒟蒻，我只会瞎暴力，开始做法是把比分一个一个输进去，往死里判断，但是发现太累了。
于是想到一个做法：一个字符一个字符输进去，判断已经输到了哪里

		while(1){
            scanf("%c",&amp;nlong);
            if(nlong=='-')break;
            else if((nlong&gt;='a'&amp;&amp;nlong&lt;='.]]></description><category></category></item><item><title><![CDATA[题解洛谷P3887（c++解法）[GDOI2014]世界杯]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/106076752</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/106076752</guid><author>dogcat987</author><pubDate>Tue, 12 May 2020 15:09:03 +0800</pubDate><description><![CDATA[思路：守门员单算，比较简单，剩下三种类型的拿中场说。
假设你有16个中场球员，他们是：（表格纯手打）（剩下几名球员power从60到72不等）
 -------------- --------------  
|   name       | power        |
| -----------: | -----------: |
|    666       | 22           |
|    god       | 88           |
|    messi     | 99    ]]></description><category></category></item><item><title><![CDATA[题解洛谷P6013（c++解法）[CSGRound3]压岁钱]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/106054314</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/106054314</guid><author>dogcat987</author><pubDate>Mon, 11 May 2020 14:53:51 +0800</pubDate><description><![CDATA[直接模拟就可以了
注意：钱数最好用数组存起来，这样处理封印情况才会比较方便。
#include &lt;iostream&gt;

using namespace std;

long long in[1000005];
long long out[1000005];

int main(int argc, char** argv)
{
    int n;
    int i;
    int c;
    long long w, x = 0;
    long long m, s = 0;
    c]]></description><category></category></item><item><title><![CDATA[题解洛谷P1161（c++解法）开灯]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/106050484</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/106050484</guid><author>dogcat987</author><pubDate>Mon, 11 May 2020 11:27:56 +0800</pubDate><description><![CDATA[这题第一眼感觉好麻烦的样子呢。。但事实上还是很水的呢。。
很草率暴力的模拟就行了。。。。
输入的同时进行计算，并且给个bool类型的数组来统计该位置的灯是开还是关，然后最后遍历一下整个bool数组，是开着的输出就好了。
时间复杂度是O(n*ti)，不会超时的。
#include&lt;bits/stdc++.h&gt;
using namespace std;
int n,t;
long long T;
double a;
bool ai[2000010];
int main()
{
    scanf("]]></description><category></category></item><item><title><![CDATA[题解洛谷P2392（c++解法）kkksc03考前临时抱佛脚]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/106043730</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/106043730</guid><author>dogcat987</author><pubDate>Sun, 10 May 2020 22:28:19 +0800</pubDate><description><![CDATA[输入N个数，将这N个数能够分成两组，使得两组总数最接近就是本题的解法。可以用搜索，递归，也可以用01背包。由于我太弱……所以用的深搜……
#include&lt;cstdio&gt;
#include&lt;algorithm&gt;
#include&lt;cstring&gt;
#define MAXN 25
#define MAXM 610
using namespace std;
int s1,s2,s3,s4;
inline int read()
{
	int date=0,w=1;char c=]]></description><category></category></item><item><title><![CDATA[题解洛谷P1170（c++解法）兔八哥与猎人]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/106043695</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/106043695</guid><author>dogcat987</author><pubDate>Sun, 10 May 2020 22:26:41 +0800</pubDate><description><![CDATA[题目中所求是两个整点之间是否存在其他整点
根据直线在平面直角坐标系上的定义，点(x,y)在点(x1,y1)和点(x2,y2)所确定的线段上，当且仅当(x-x1):(y-y1)==(x-x2):(y-y2)=(x1-x2):(y1-y2)（范围x1&lt;=x&lt;=x2,y1&lt;=y&lt;=y2）
由此，我们可以得知，两个整点之间存在其他的整点的话，必然有(x-x1):(y-y1)==(x-x2):(y-y2)，因为x,y,x1,y1,x2,y2都是整数，那么(x-x1),(y-y1),(x-x2)]]></description><category></category></item><item><title><![CDATA[题解洛谷P4771（c++解法）八百标兵奔北坡]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/106043392</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/106043392</guid><author>dogcat987</author><pubDate>Sun, 10 May 2020 22:11:37 +0800</pubDate><description><![CDATA[这是一道非常成功的题目（完全看不出是DP），于是身为蒟蒻的我就开始乱搞~~（乱搞压标算）~~ ， 在被样例图示坑到后，我完成了一份成功的暴力，如下

#include&lt;iostream&gt;
#include&lt;cstdio&gt;
#include&lt;cstring&gt;
using namespace std;
int e[1005][1005],im[1005][1005];
struct node
{
	int x,y;
}a[100005];
int cnt[1005]={0}.]]></description><category></category></item><item><title><![CDATA[题解洛谷P1004（c++解法）方格取数]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/105908063</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/105908063</guid><author>dogcat987</author><pubDate>Fri, 08 May 2020 18:29:52 +0800</pubDate><description><![CDATA[题目传送门
我们做题的思路可以这样：
①先看一下出题日期（毕竟是NOIP的题目，有一定的水准），然后发现是2000年的普及第四题
我们要知道的是，好像比较前面的几年由于1999的数塔IOI问题后，接下来几年的最后一两题都很喜欢出DP
所以，我们首先看一下题目的内容，求路径最大的方法，这时候就要想到DP或者DFS
②然后我们发现题目的数据规模不大，n&lt;=9，所以我们可以考虑用DFS或者DP都可...]]></description><category></category></item><item><title><![CDATA[题解洛谷P2128（c++解法）赤壁之战]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/106002040</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/106002040</guid><author>dogcat987</author><pubDate>Fri, 08 May 2020 17:22:33 +0800</pubDate><description><![CDATA[思路是枚举第i艘船并判断是否与前面选的船都有铁索相连。如果都有，就把这艘船的编号放进一个数组里。最后用一个max1的数存最大值，输出max1。
代码如下(▽)
#include &lt;bits/stdc++.h&gt;//懒人喜欢的万能头文件
using namespace std;
int a[1000],b[5000][5000],c[10000],used[100000];//a数组存的是...]]></description><category></category></item><item><title><![CDATA[题解洛谷P1252（c++解法）马拉松接力赛]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/106000673</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/106000673</guid><author>dogcat987</author><pubDate>Fri, 08 May 2020 16:41:11 +0800</pubDate><description><![CDATA[对于这道题，如果使用暴力的全排列来做的话，那么显然时间复杂度会妥妥的达到10^5，如果我们想要过掉所有的数据点的话，暴力排列就显得十分无力，所以我们要选择别的方法。
这道题的特点在于要求最小值，因此我们可以往贪心和dp上去想，这里介绍一种贪心算法：
由于每个人都需要跑，因此第一步肯定要将每一个人分配一公里，那么接下来该怎么办呢？
显然无论在什么状态下，我们都要找跑这一公里最快的人来跑，因此我们只要...]]></description><category></category></item><item><title><![CDATA[题解洛谷P1498（c++解法）南蛮图腾]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/105976874</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/105976874</guid><author>dogcat987</author><pubDate>Thu, 07 May 2020 17:13:55 +0800</pubDate><description><![CDATA[发一个分治的题解好了。
用二维字符数组存储结果，初始化全部是空格，修改需要修改的变量即可。
思路：打印一个距离最左端有dist个空格，尺寸为size，最下一行在数组中height行的三角形时，
如果size为1，直接存储；
否则打印顶部、左下和右下的三个小三角形，具体坐标见代码。
由于“\”是C++中的转义字符，可以使用char x=(char)92的方式将字符变量x赋值为“\”。
代码来了
#i...]]></description><category></category></item><item><title><![CDATA[题解洛谷P6467（c++解法）[COCI2008-2009#6]BUKA]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/105956435</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/105956435</guid><author>dogcat987</author><pubDate>Wed, 06 May 2020 18:18:22 +0800</pubDate><description><![CDATA[然后，我们做题，要将这道题分为两个大if分别对应中间的符号为‘+’或者‘*’这个谁都会。
先定义一些变量，做一些基本操作：
string a,b;//两个输入的字符串
char x;//重点，中间那个输入的字符
cin&gt;&gt;a&gt;&gt;x&gt;&gt;b;//输入
int as=a.size();//字符串a的长度
int bs=b.size();//字符串b的长度
if(as&...]]></description><category></category></item><item><title><![CDATA[题解洛谷P6244（c++解法）[USACO06OPEN]County Fair Events S]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/105939154</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/105939154</guid><author>dogcat987</author><pubDate>Tue, 05 May 2020 21:19:26 +0800</pubDate><description><![CDATA[思路
这道题就是活动安排（贪心裸题）其实就是求对应数轴选择尽可能多的不相交线段。
于是我们想到一种贪心策略：按照每个活动的结束时间从小到大排序，每次选择最早的结束时间，于是代码：
#include&lt;bits/stdc++.h&gt;
using namespace std;
struct AKIOI{
	int st;
	int ed;
}
a[10010];
bool cmp(AKIOI ...]]></description><category></category></item><item><title><![CDATA[题解洛谷P2240（c++解法）【深基12.例1】部分背包问题]]></title><link>https://blog.youkuaiyun.com/dogcat987/article/details/105937056</link><guid>https://blog.youkuaiyun.com/dogcat987/article/details/105937056</guid><author>dogcat987</author><pubDate>Tue, 05 May 2020 19:03:20 +0800</pubDate><description><![CDATA[千万不要被题目给误导了，这道题是贪心。
所有金币都可以分开，也就是说只要按照性价比最高的取一定得到的价值最大。
性价比就是这堆金币的价值除以重量。
只需要把这nn堆金币按性价比排序就行了。
然后依次遍历，如果背包中剩余可以拿的重量大于等于这堆金币的重量，就全拿，否则直接装满。
直接装满这里注意一下整型转浮点的细节就好了。
代码如下：
#include&lt;cstdio&gt;
#include&...]]></description><category></category></item></channel></rss>