07 2019 档案
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 int main() 6 { 7 int t,x,y,loc,cnt; 8 int vis[210000]; 9 queue que1,que2; 10 cin >> t; 11 while (t != 0) 12 ...
阅读全文
摘要:1 #include 2 using namespace std; 3 int main() 4 { 5 int n,x,y; 6 int x1[11000],y1[11000],lx[11000],ly[11000]; 7 cin >> n; 8 for (int i = 1;i > x1[i] >> y1[i] >> lx[i] >> ly[...
阅读全文
摘要:1 #include 2 #include 3 using namespace std; 4 struct stu 5 { 6 string name; 7 int y; 8 int m; 9 int d; 10 int id; 11 friend bool operator > n; 45 for (int i = ...
阅读全文
摘要:1 #include 2 #include 3 using namespace std; 4 int main() 5 { 6 int w,n,p[31000],res = 0; 7 cin >> w; 8 cin >> n; 9 for (int i = 1;i > p[i]; 11 sort(p + 1,p + n + 1); 1...
阅读全文
摘要:1 #include 2 #include 3 using namespace std; 4 struct stu 5 { 6 int id; 7 int ch; 8 int mth; 9 int eng; 10 friend bool operator > n; 38 for (int i = 1;i > vec[i].ch...
阅读全文
摘要:1 #include 2 using namespace std; 3 int vis[10],ans[10],n; 4 void f(int x) 5 { 6 if (x == n + 1) 7 { 8 for (int i = 1;i > n; 26 f(1); 27 return 0; 28 }
阅读全文
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 int main() 6 { 7 string a,b,tmp; 8 int x[11000] = {},y[11000] = {},z[11000] = {}; 9 int ok = 0; 10 cin >> a >> b;...
阅读全文
摘要:1 #include 2 #include 3 using namespace std; 4 int main() 5 { 6 string a,b; 7 cin >> a >> b; 8 int x[11000] = {},y[11000] = {},z[11000] = {}; 9 for (int i = 0;i = 1;i--) 25...
阅读全文
摘要:1 #include 2 #include 3 using namespace std; 4 struct test 5 { 6 int a; 7 int b; 8 friend bool operator > n; 18 for (int i = 1;i > vec[i].a >> vec[i].b; 20 sort(vec + 1,...
阅读全文
摘要:1 #include 2 using namespace std; 3 int n,a[110],tot,res; 4 int check(int x) 5 { 6 if (x != 0) 7 return 1; 8 return 0; 9 } 10 int main() 11 { 12 scanf("%d",&n); 13 f...
阅读全文
摘要:1 #include 2 using namespace std; 3 int a[51000]; 4 int len,m,n; 5 bool check(int x) 6 { 7 int last = 0; 8 int ans = 0; 9 for (int i = 1;i m) 17 return false; 18 re...
阅读全文
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 int tot1,tot2,score1_W,score1_L,score2_W,score2_L; 6 int res1[6000][3],res2[6000][3]; 7 bool fnsh; 8 int main() 9 { 10 int le...
阅读全文
摘要:1 #include 2 using namespace std; 3 int n; 4 int main() 5 { 6 scanf("%d",&n); 7 int tmp; 8 for (int i = 0;i 0) 16 printf("+"); 17 else 18 ...
阅读全文
摘要:1 #include 2 using namespace std; 3 int n,a[50][50]; 4 int main(){ 5 scanf("%d",&n); 6 int x,y; 7 x=1; 8 y=n/2+1; 9 a[x][y]=1; 10 for(int i=2;i<=n*n;i++){ 11 ...
阅读全文
摘要:#include using namespace std; int n,na,nb; int mp[5][5]{{0,0,1,1,0},{1,0,0,1,0},{0,1,0,0,1},{0,0,1,0,1},{1,1,0,0,0}}; int vec[3][250],ans[3]; int main() { scanf("%d%d%d",&n,&na,&nb); for (in...
阅读全文
摘要:显然结论 一个点不会经过了两次,一个阀门不会反复开关。第一条边为0,其余边为1。
阅读全文
摘要:1 #include 2 using namespace std; 3 int n,na,nb; 4 int mp[5][5]{{0,0,1,1,0},{1,0,0,1,0},{0,1,0,0,1},{0,0,1,0,1},{1,1,0,0,0}}; 5 int vec[3][250],ans[3]; 6 int main() 7 { 8 scanf("%d%d%d",...
阅读全文
摘要:1 #include 2 #include 3 using namespace std; 4 typedef long long ll; 5 const int N = 200100,M = 400100,mo = 10007;//用变量方便更改 6 int cnt,n,maxn; 7 ll ans; 8 int w[N],head[N],to[M],nxt[M]; 9 ...
阅读全文
摘要:考虑Dp. 设f[i][j]表示当前在第i个垃圾,高度为j,最多可以存活到什么时候。 转移方程就是f[i][j]=max(f[i-1][j-h[i]], f[i-1][j]+a[i]) //第二维循环顺序,就是顺手写了个逆序,实际上没有影响,避免误导,已更正 f[i][j] 表示考虑前i个垃圾,存货
阅读全文
摘要:枚举出所有的的回文数,然后判断其是否在范围内,是否是素数即可。
阅读全文
摘要:1 //枚举最高高度,不断计算答案,并取min即可。记得初始值赋正无穷 2 #include 3 #include 4 using namespace std; 5 int n,tot,ans = 1000000000; 6 int h[1010]; 7 int sqr(int x) 8 { 9 return x * x; 10 } 11 int main() 1...
阅读全文
摘要:看到木板最大数目,容易下意识想到二分。但是我们冷静思考下,这道题怎么样才能使总长度最短。 因为有些牛不在,所以有些牛棚是不需要覆盖木板的。如果能每个牛棚分单独一个木板,一定总长度是最小的。但是由于木板数量有限制,所以我们有时只能用一个比较长的木板的时候,顺便把没有牛的牛棚也覆盖了。就造成了浪费。所以
阅读全文
摘要:1 //这道题让我想起来班主任的名言,你上课耽误1分钟,大家40个人,就耽误了大家40分钟。一样的道理,越靠前的人耽误的人越多,所以让快的人尽量靠前。 2 #include 3 #include 4 using namespace std; 5 struct dat 6 { 7 int id,tim; 8 friend bool operator < (da...
阅读全文
摘要:1 //于其说是一道贪心题,不如说是一道考察结构体运用的题目。对于重载运算符一定要熟练运用。 我们优先购买便宜的牛奶即可,注意使用min函数节约代码量。 2 #include 3 #include 4 #include 5 using namespace std; 6 int n,m,ans; 7 struct node 8 { 9 int a,b;//牛奶单价和产量...
阅读全文
摘要:1 //没什么好说的,要注意的就是一定要边计算边取模,这道题不这么做也不会溢出,但是在NOIP中绝不会这么简单。一定记得随时取模。再一个就是这种输出字符串的,一定要从原文复制粘贴,注意细节。 2 #include 3 #include 4 using namespace std; 5 char s1[10],s2[10]; 6 int main() 7 { 8 ...
阅读全文
摘要:1 //难点在于锁有容错性,左右相邻均可。并且这里题目规定了从1开始,所以不倾向与从0开始。这里写一个函数来单独用来判断相邻的问题,做题时,如果某个部分感到实现困难可以将其拆成不同部分,逐一击破。 2 #include 3 #include 4 using namespace std; 5 int n,res; 6 int pwd[3][4]; 7 bool cls(int ...
阅读全文
摘要:1 //因为每个桶的上限只有20,最多只有20*20*20个状态,我们用vis[x][y][z]表示一个状态是否被搜索过。然后每次尝试各种转移,发现答案就记录答案。 2 #include 3 #include 4 #include 5 using namespace std; 6 bool ans[30],vis[30][30][30]; 7 int a,b,c; 8 v...
阅读全文
摘要:1 //打出表可以看到,集合内有大约cnt=120000个数。做法是枚举等差数列前两个数,然后再用一个N去判断序列后面每一位是否存在。复杂度高达cnt^2*n,加了玄学优化可以过,应该不是正解。 2 #include 3 #include 4 #include 5 using namespace std; 6 vector vec; 7 int n,m; 8 int v...
阅读全文

浙公网安备 33010602011771号