上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 67 下一页
摘要: 注意对全为孤立点的情况进行处理。 const int N=1e5+10; set<int> node; vector<int> g[N]; int din[N]; bool vis[N]; vector<int> res; int n; void bfs(int st) { priority_que 阅读全文
posted @ 2021-02-18 17:34 Dazzling! 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 注意特判max可能在a[0]位置,此时调换最小值后最大值下标会不准确,需要将最大值下标更新为上一步交换后的下标。 int a[10]; int main() { string line; while(getline(cin,line)) { stringstream ss(line); int mi 阅读全文
posted @ 2021-02-18 16:09 Dazzling! 阅读(271) 评论(0) 推荐(0) 编辑
摘要: 水题~。 const int N=1e5+10; map<int,int> mp; bool vis[N]; int a[10010]; int n,m; int main() { cin>>n; for(int i=0;i<n;i++) { int a,b; cin>>a>>b; mp[a]=b, 阅读全文
posted @ 2021-02-18 10:59 Dazzling! 阅读(10) 评论(0) 推荐(0) 编辑
摘要: 太菜了,面对一个$20$分的题乱搞许久。 题意 键盘上有一些键位坏了,当按一次这些键时,都会固定输出k次这些字符。现在告诉你k的值,以及最终输出的字符串,输出可能坏的键位和原始字符串。 思路 由于坏的键位每按一次就会出现k个重复键位,因此对任何一个键位,只要它在字符串中每次连续出现的长度都是k的整数 阅读全文
posted @ 2021-02-18 10:39 Dazzling! 阅读(31) 评论(0) 推荐(0) 编辑
摘要: 一眼二分。 二分左边界应该取$0$而不能取$a$数组中最小值(起码是最小值减$1$,因为要求严格大于$E$的天数),右边界由题目得为$N$。 const int N=1e5+10; int a[N]; int n; bool check(int x) { int cnt=0; for(int i=0 阅读全文
posted @ 2021-02-17 23:19 Dazzling! 阅读(53) 评论(0) 推荐(0) 编辑
摘要: 这不双指针板子题吗🎈。 const int N=1e5+10; int a[N]; int n,m; int main() { cin>>n>>m; for(int i=0;i<n;i++) cin>>a[i]; sort(a,a+n); int l=0,r=n-1; bool ok=false; 阅读全文
posted @ 2021-02-17 21:14 Dazzling! 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 对输入的每一个数,进行3n+1猜想的操作,对其中经过的每一个数x,插入集合中表示x被覆盖。 记录关键数,并从大到小排序,最后输出即可。 const int N=110; int a[N]; set<int> S; int n; int main() { cin>>n; for(int i=0;i<n 阅读全文
posted @ 2021-02-17 21:02 Dazzling! 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 水~。 map<int,int> mp; int n; int main() { cin>>n; for(int i=0;i<n;i++) { int team_id,player_id,grade; scanf("%d-%d %d",&team_id,&player_id,&grade); mp[ 阅读全文
posted @ 2021-02-17 19:50 Dazzling! 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 既然要按PATest的顺序输出,那么就开一个数组cnt[6], 用来记录六个字符分别出现的个数(同时用一个变量tot记录总个数)。这样在读入字符串之后,就可以直接统计出这个数组。 遍历cnt数组,如果cnt[j]不为0,那么输出dict[i],并让cnt[i]减1、sum减1。如果sum变为0,那么 阅读全文
posted @ 2021-02-17 19:43 Dazzling! 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 水~。 map<char,int> mp; int main() { string s; getline(cin,s); for(auto t:s) if(isalpha(t)) mp[tolower(t)]++; char c='a'; for(auto t:mp) if(t.se > mp[c] 阅读全文
posted @ 2021-02-17 19:24 Dazzling! 阅读(22) 评论(0) 推荐(0) 编辑
上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 67 下一页