2017中国大学生程序设计竞赛
来源:互联网 发布:数据透视表多条件筛选 编辑:程序博客网 时间:2024/05/22 01:32
题目链接
01:http://acm.hdu.edu.cn/showproblem.php?pid=6150
02:http://acm.hdu.edu.cn/showproblem.php?pid=6151
03:http://acm.hdu.edu.cn/showproblem.php?pid=6152
04:http://acm.hdu.edu.cn/showproblem.php?pid=6153
05:http://acm.hdu.edu.cn/showproblem.php?pid=6154
06:http://acm.hdu.edu.cn/showproblem.php?pid=6155
07:http://acm.hdu.edu.cn/showproblem.php?pid=6156
08:http://acm.hdu.edu.cn/showproblem.php?pid=6157
09:http://acm.hdu.edu.cn/showproblem.php?pid=6158
10:http://acm.hdu.edu.cn/showproblem.php?pid=6159
11:http://acm.hdu.edu.cn/showproblem.php?pid=6160
比赛时两题入账,但我觉得这就是发挥出我们队的实力了,比赛的时候感觉挺充实的,一直都在思考。
一些题解
03 Friend-Graph
题目是说给你一个关系图,第i个人和其他n - i个人的关系给出,1代表能成为朋友,0代表不能成为朋友,当3个人及以上没有朋友或者三个及以上都互相是朋友时就是bad team否则就是good team。
本题一开始妄图用强连通果断超内存,后来直接建两张图,互为盆友的连通,不为朋友的连通,然后只要每次搜一遍看看朋友的盆友是否连通即可,如果连通直接判断为不行。
#include <bits/stdc++.h>using namespace std;typedef long long ll;const int mod = 1e9+7;const int maxn = 3003;bool g[maxn][maxn];inline int read(){ int pre=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){pre=pre*10+ch-'0';ch=getchar();} return pre*f;}#define clr(a,b) memset(a,b,sizeof(a))bool solve(int n){ for(int i=1;i<=n-2;i++) { vector<int>G1,G2; G1.clear(); G2.clear(); for(int j=i+1;j<=n;j++) { if(g[i][j]==1) G1.push_back(j); else G2.push_back(j); } for(int j=0;j<G1.size();j++) { for(int k=j+1;k<G1.size();k++) if(g[G1[j]][G1[k]]==1) { return 0; } } for(int j=0;j<G2.size();j++) { for(int k=j+1;k<G2.size();k++) if(g[G2[j]][G2[k]]==0) { return 0; } } } return 1;}int main(){ int t = read(); while(t--) { clr(g,0); int n = read(); for(int i=1;i<=n-1;i++) { for(int j=i+1;j<=n;j++) { int x = read(); if(x==1) g[i][j]=1; } } printf("%s\n",solve(n)?"Great Team!":"Bad Team!"); } return 0;}
05 CaoHaha’s staff
题目是说给你一个物品的大小,然后给你一个方格纸告诉你每一笔只能横着或者竖着画一个单位线段,或者走正方形的斜边画一道根号2单位的线,问最少画几道可以覆盖大于等于题目给定的物品大小的面积。
运用二分答案,看看一定的笔数最多可以覆盖多少大的面积。如果当前笔数是偶数那么将它除以2,如果还是偶数就是mid/2/2 * mid / 2/ 2 * 2,如果奇数就是mid/2/2 * (mid/2/2 + 1)*2。如果当前笔画数是奇数,就把当前数减一然后和偶数时一样,最后再加上mid/2/2(意思就是一条边向外扩展一个梯形)就是奇数时的最大覆盖数。
#include <iostream>#include <cstdio>#include <algorithm>#include <cstring>using namespace std;typedef long long LL;int main(){ //freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout); int t; scanf("%d", &t); while(t--) { LL n; scanf("%I64d", &n); LL l = 4, r = 1e6; LL az = n; while(r >= l) { LL ans; LL mid = (l + r) / 2; LL midd = mid; if(mid % 2 == 0) { mid /= 2; if(mid % 2 == 0) { mid /= 2; ans = mid * mid * (LL)2; } else { mid /= 2; ans = mid * (mid + 1) * (LL)2; } } else { mid /= 2; if(mid % 2 == 0) { mid /= 2; ans = mid * mid * (LL)2; } else { mid /= 2; ans = mid * (mid + 1) * (LL)2; } ans += mid; } if(ans < n) { l = midd + 1; } else if(ans >= n) { az = midd; r = midd - 1; } } printf("%I64d\n", az); } return 0;}
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 2017中国大学生程序设计竞赛
- 【HDU6150 2017中国大学生程序设计竞赛
- 【HDU6152 2017中国大学生程序设计竞赛
- 【HDU6153 2017中国大学生程序设计竞赛
- 使用python的BeautifulSoup库解析页面应选择适当容错能力的解析器
- openoffice问题:conversion failed: could not save output document; OOo errorCode: 283
- Android 三大图片缓存原理、特性对比
- 1159. 【NOI2002】银河英雄说(并查集)
- 接口自动化之thirdDay JsonGuolvTest 过滤掉某个字段的值 price
- 2017中国大学生程序设计竞赛
- Mapreduce二次排序实例
- Spring-AOP 自动创建代理
- 为MacOS升级vim至最新版
- 界面打飞机游戏,C语言
- c++常用知识点2
- Delphi Class of
- springMVC
- glibc free 死锁