#include <stdio.h>#include <string.h>int main(){ int n,i,flag,l; int str[1000]; char ch[1111]; scanf("%d",&n); while(n--) { scanf("%s",ch); memset(str ...
分类:
其他好文 时间:
2019-12-03 23:40:32
阅读次数:
126
ch只有最低的字节起作用 自己写的memcpy可能存在内存重叠问题,要特别注意 ...
分类:
其他好文 时间:
2019-11-30 21:17:45
阅读次数:
82
/////////////////////////////////定义节点结构体 struct node{ int data; struct node *pnext;}; ////////////////////////////////////main函数 int main(){ struct no ...
分类:
其他好文 时间:
2019-11-30 16:28:16
阅读次数:
94
暴力 其实这题的暴力就是个模拟。暴力扫一遍 $conn(s_1, n_1)$,若出现了 $res$ 个 $s_2$。 答案就是 $\lfloor res / n1 \rfloor$。 时间复杂度 $O(T(|s_1|n1))$。 优化 考虑字符串是一直循环的,每走完一个 $s_2$,他会从一个位置重 ...
struct mat { LL ma[sz][sz]; inline mat() { memset(ma, 0, sizeof ma); } inline mat operator+(const mat & T) const { mat res; for (int i = 0; i < sz; ++ ...
分类:
其他好文 时间:
2019-11-29 13:06:19
阅读次数:
57
暴力枚举$2^{d}$表示这d个点中一定不选A或一定不选B(那么就包含了所有情况),然后就对原图跑2-sat即可注意一个细节,如果某一条限制中初始点不合法,就不用管了;如果最终点不合法,那么相当于初始点不能选,可以用向同类连边的方式来标记一定不能选 1 #include<bits/stdc++.h> ...
分类:
其他好文 时间:
2019-11-27 19:07:49
阅读次数:
59
复杂度 O(N) bool isPrime[1000001]; //isPrime[i] == 1表示:i是素数 int Prime[1000001], cnt = 0; //Prime存质数 void GetPrime(int n)//筛到n { memset(isPrime, 1, sizeof ...
分类:
其他好文 时间:
2019-11-24 11:52:07
阅读次数:
65
"题目链接" 今天机房模拟赛的题目,先用爆搜做的,后面去写了dijkstra(~~没想到过掉了~~) 本菜鸡之前并没有学过分层图,所以我感觉用的是dijkstra加动态规划的思想 我们用$dis[i][j]$来表示到从1号牧场到第$i$号牧场升级$j$条路所花的最短时间,设第$x$号牧场与第$i$号 ...
分类:
其他好文 时间:
2019-11-24 10:18:39
阅读次数:
50
//只能拿某些特定个数的石子 #include <cstring> #include <iostream> #include <algorithm> #include <unordered_set> using namespace std; const int N = 110, M = 10010; ...
题意: 给你一个n位的数x(A(n)A(n-1)...A(1)),那么F(x)=A(n)*2^(n-1)+A(n-1)*2^(n-2)......+A(1)*2^(0) 题目输入A、B 你需要找出来在[0,B]这个范围内有多少个数的F(x)大于F(A) 题解: 这个就是卡memset函数的,而且要注 ...
分类:
其他好文 时间:
2019-11-23 16:21:26
阅读次数:
64