摘要: 题意: 给定每个人的家庭成员和其自己名下的房产,请你统计出每个家庭的人口数、人均房产面积及房产套数。 思路: 输入和输出各构造一个结构体,利用并查集归并输入,枚举编号进行输出。 #include <bits/stdc++.h> using namespace std; const int M=110 阅读全文
posted @ 2020-03-16 22:30 Kanoon 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 题意: n x m 的网格,p 个玩家轮流BFS,给出每个玩家每次能遍历的最远距离和网格初始状态(可遍历点、障碍点、每个玩家的遍历起点(可多个)),问每个玩家最多能遍历多少点。 Tips: 以所有玩家无法再进行遍历而不是已遍历所有点为终止条件。 #include <bits/stdc++.h> us 阅读全文
posted @ 2020-03-16 17:50 Kanoon 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 题意: 长为 n,由 l ~ r 中的数组成,其和模 3 为 0 的数组数目。 思路: dp[ i ][ j ] 为长为 i,模 3 为 j 的数组数目。 #include <bits/stdc++.h> using namespace std; const int M=220000; const 阅读全文
posted @ 2020-03-16 17:32 Kanoon 阅读(111) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; int main() { int n,k;cin>>n>>k; string s;cin>>s; int ans[26]={0}; for(int i=0;i<n;i++){ int len=1; while 阅读全文
posted @ 2020-03-16 17:21 Kanoon 阅读(89) 评论(0) 推荐(0) 编辑
摘要: #include <bits/stdc++.h> using namespace std; int main() { int n;cin>>n; int a[n];for(int &i:a) cin>>i; int ans_ave=0,ans_cost=INT_MAX; for(int i=1;i< 阅读全文
posted @ 2020-03-16 17:16 Kanoon 阅读(114) 评论(0) 推荐(0) 编辑