ICode9

精准搜索请尝试: 精确搜索
  • Codeforces Round #572 (Div. 2)简要题解2019-07-14 14:40:10

    A. Keanu Reeves 分析:01个数相等答案就是1,不相等就是2。 #include "bits/stdc++.h" using namespace std; int main(){ int n; string s; cin>>n>>s; int z=0,o=0; for (int i = 0; i < n; ++i) { if(s[i]=='1')o++;

  • Tokitsukaze and Strange Rectangle CodeForces - 1191F (树状数组,计数)2019-07-14 13:02:21

    大意: 给定$n$个平面点, 定义集合$S(l,r,a)$表示横坐标$[l,r]$纵坐标$[a,\infty]$内的所有点. 求可以得到多少种不同的集合.   从上往下枚举底层最右侧点, 树状数组统计贡献. #include <iostream>#include <algorithm>#include <cstdio>#define REP(i,a,n) for(int i=a;i<=n;++i)

  • CodeForces - 417C Football2019-07-14 11:38:22

    会卡cout!!!!! 第一个是cin +printf 第二个是scanf + printf cout会T,,,比赛卡了1小时,自闭 水题,需要用 组合数判断一下 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e7 + 7; int n, k; int book[N]; int flag = 0; int main() { scan

  • Codeforces 892E Envy2019-07-13 23:57:33

    问题描述 小Q正在玩一个叠塔的游戏,游戏的目标是叠出尽可能高的塔。在游戏中,一共有n张矩形卡片,其中第i张卡片的 长度为a_i,宽度为b_i。小Q需要把所有卡片按一定顺序叠成一座塔,要求对于任意一个矩形,它的长度要严格大 于它上边的任意一个矩形的长度。塔的高度为所有矩形的宽度之和。在

  • Codeforces Round #573 (Div. 2) C. Tokitsukaze and Discard Items2019-07-13 21:55:25

    Codeforces Round #573 (Div. 2)   C - Tokitsukaze and Discard Items Recently, Tokitsukaze found an interesting game. Tokitsukaze had n items at the beginning of this game. However, she thought there were too many items, so now she wants to discard m (1≤m

  • Codeforces - 1191F - Tokitsukaze and Strange Rectangle - 组合数学 - 线段树2019-07-13 21:52:17

    https://codeforces.com/contest/1191/problem/F 看了一下题解的思路,感觉除了最后一段以外没什么启发。 首先离散化x加快速度,免得搞多一个log。其实y不需要离散化。 规定无穷大就是xn+1这个很好理解嘿嘿。(反正开多了5个不怕) 注意到其实从上往下一行一行扫过去,每次必须新增的元素才

  • Codeforces Round #573 (Div. 2)2019-07-13 20:50:47

    A.Tokitsukaze and Enhancement 题意:ABCD四个等级,给你一个数,然后按照规则寻找能接近的最大等级,只能加上0-2;(看来只适合做这种水题 #include <bits/stdc++.h>using namespace std;const int maxn=1e5+10;const int inf=0x3f3f3f3f; int main(){ int n; cin>>n; if(n%4==1)

  • Codeforces Round #573 (Div. 2)2019-07-13 16:51:06

    http://codeforces.com/contest/1191 第二题: 判断三个数是否是相同或者含顺序位置的关系,另外答案只可能是0,1,2 ans==0,说明首先三个数的字母完全相同,另外三个数的数字大小相同或者大小呈顺序关系 ans==1,  说明至少2个数的字母完全相同,另外这2个数的数字大小相同或者大小呈顺序关系(

  • Codeforces Round #572 (Div. 2) C. Candies! (思维or记忆化)2019-07-12 19:37:56

    题目链接:http://codeforces.com/contest/1189/problem/C 题意:现在有nnn个数,保证nnn是222的次方数,现在qqq次询问,每次询问给出一个区间,保证区间长度是222的次方数,将区间里面的数2∗i2*i2∗i和2∗i+12*i+12∗i+1相加形成一个新的数,如果大于等于10,答案加1,然后将和对10取模,最后合

  • Please, another Queries on Array?(Codeforces Round #538 (Div. 2)F+线段树+欧拉函数+bitset)2019-07-12 17:03:04

    题目链接 传送门 题面 思路 设\(x=\prod\limits_{i=l}^{r}a_i\)=\(\prod\limits_{i=1}^{n}p_i^{c_i}\) 由欧拉函数是积性函数得: \[ \begin{aligned} \phi(x)&=\phi(\prod\limits_{i=1}^{n}p_i^{c_i})&\\ &=\prod\limits_{i=1}^{n}\phi(p_i^{c_i})&\\ &=\

  • Codeforces Round #269 (Div. 2) A B C2019-07-12 12:06:35

    A:MUH and Sticks #include<bits/stdc++.h>using namespace std;int a[10]={0};int main(){ int c; for(int i=0;i<6;i++){ cin>>c; a[c]++; } bool flag=false; for(int i=1;i<=9;i++){ if(a[i]>=4) { a[i]-=4; flag=true; } } if(!flag) cout

  • Codeforces Round #566 (Div. 2)2019-07-11 23:02:46

    A. Filling Shapes 题意:给你三角形,填充3*n的图; n为奇数肯定不行,n每增加一个,填充的办法就为上次的两倍; #include <bits/stdc++.h>using namespace std;const int maxn=1e5+10;int main(){ int n; cin>>n; if(n%2) { cout<<0<<endl; } else {

  • Codeforces 1109D: generalizations of Cayley's formula证明2019-07-11 19:02:29

    做这题的时候发现题解里有提到$generalizations of Cayley's formula$的,当场懵逼,Wikipedia里也就带到了一下,没有解释怎么来的,然后下面贴了篇论文。 大概就是$n$个点$k$个联通块的森林,$1,2,\cdots,k$属于不同的联通块,这样不同的方案数共有$k\cdot n^{n-k-1}$种。 我自己用$Prüfe

  • Codeforces Round #570 (Div. 3) F. Topforces Strikes Back2019-07-10 20:07:52

    题目链接:http://codeforces.com/contest/1183/problem/F 题意:现在有nnn个数,你需要选333个数出来,使333个数的和最大,要求是三个数任意两个做除数和被除数余数不能等于000。 解题心得:看起来nnn很大,但是可以直接DFSDFSDFS暴力搜索,因为只选三个数所以递归不会超过三层,并且可以剪

  • Codeforces Round #565 (Div. 3) F.Destroy it!2019-07-10 14:01:20

    ## F. Destroy it! 题目地址:http://codeforces.com/contest/1176/problem/F **思路:其实就是一个01背包问题,只是添加了回合和每回合的01限制,和每当已用牌数到了10的倍数,那张卡会触发double攻击。因为卡使用的多少会触发double效果,所以我们要记录攻击的同时记录卡的使用次数,可以由01

  • codeforces#572Div2 E---Count Pairs【数学】【同余】2019-07-09 10:52:03

    题目:http://codeforces.com/contest/1189/problem/E 题意:给定$n$个互不相同数,一个$k$和一个质数$p$。问这$n$个数中有多少对数$(a_i+a_j)(a_i^2+a_j^2)\equiv k\,mod\,p$ 思路:这一场的题目好像都很思维啊,代码量不多,想得出来就能写。 同余式左右两边同乘一个非零的数同余式不变,所以

  • Codeforces Round #569 (Div. 2) B. Nick and Array2019-07-09 09:57:53

    链接: https://codeforces.com/contest/1180/problem/B 题意: Nick had received an awesome array of integers a=[a1,a2,…,an] as a gift for his 5 birthday from his mother. He was already going to explore its various properties but after unpacking he was disappointe

  • Codeforces Round #569 (Div. 2) C. Valeriy and Deque2019-07-09 09:52:17

    链接: https://codeforces.com/contest/1180/problem/C 题意: Recently, on the course of algorithms and data structures, Valeriy learned how to use a deque. He built a deque filled with n elements. The i-th element is ai (i = 1,2,…,n). He gradually takes the firs

  • Codeforces Round #570 (Div. 3 )A2019-07-07 23:56:54

    A. Nearest Interesting Number 题目链接:http://codeforces.com/contest/1183/problem/A 题目: Polycarp knows that if the sum of the digits of a number is divisible by 3, then the number itself is divisible by 3. He assumes that the numbe

  • Codeforces 1188C DP 鸽巢原理2019-07-06 21:07:01

    题意:定义一个序列的beauty值为序列中元素之差绝对值的最小值,现在给你一个数组,问所有长度为k的子序列的beauty值的和是多少? 思路:(官方题解)我们先解决这个问题的子问题:我们可以求出beauty值大于等于给你值的序列有多少个(假设为p[i]),那么其实答案就是∑(i从1到max(a)) p[i]。怎么求p数组

  • Codeforces 1188B 式子转化2019-07-06 21:02:20

    思路:看到(a + b)想到乘上(a - b)变成平方差展开(并没有想到2333), 两边同时乘上a - b, 最后式子转化成了a ^ 4 - ka = b ^ 4 - kb,剩下的就水到渠成了。 0的时候特判一下即可。 代码: #include <bits/stdc++.h>#define LL long long#define INF 0x3f3f3f3f#define pii pair<int, int>#

  • Codeforces Round #572 (Div. 2)2019-07-06 20:55:37

    目录 Contest Info Solutions A. Keanu Reeves B. Number Circle C. Candies! D1. Add on a Tree D2. Add on a Tree: Revolution E. Count Pairs Contest Info Practice Link Solved A B C D1 D2 E F 6/7 Ø Ø Ø Ø Ø Ø - O 在比赛中通过 Ø 赛后通过 ! 尝

  • Codeforces Round #572 (Div. 2) A.2019-07-06 11:50:45

    A. Keanu Reeves 题目链接:http://codeforces.com/contest/1189/problem/A 题目: After playing Neo in the legendary "Matrix" trilogy, Keanu Reeves started doubting himself: maybe we really live in virtual reality? To find if this is true, h

  • Codeforces 360D Levko and Sets (数论好题)2019-07-04 23:57:26

    题意:有一个长度为n的数组a和一个长度为m的数组b,一个素数p。有n个集合,初始都只有一个1。现在,对(i从1到n)第i个集合执行以下操作: 对所有集合中的元素c,把c * (a[i] ^ b[j]) mod p 加入集合(j从1到m), 直到集合的元素不再增加为止。 问最后这n个集合的并有多少个元素? n到1e4, m到1e5, p

  • Codeforces Round #569 (Div. 2)2019-07-04 20:05:28

    A. Alex and a Rhombus 规律思维 #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<ld,ld> pdd; #define FI first #define S second

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有