Codeforces 1189B Number Circle】的更多相关文章

题目链接:http://codeforces.com/problemset/problem/1189/B AC代码: #include<bits/stdc++.h> using namespace std; ; int a[maxn]; int b[maxn]; int c[maxn]; bool check(int i) { ]+a[i+]) return true; else return false; } int main() { int n; cin >> n; ;i &l…
https://codeforc.es/contest/1189/problem/B 优先考虑最大的元素怎么构造.拿两个次大的围着他就很好,但是其他的怎么安排呢?就直接降序排列就可以了. a数组还开错了. #include<bits/stdc++.h> using namespace std; typedef long long ll; int n; int a[100005]; int main() { #ifdef Yinku freopen("Yinku.in", &…
http://www.codeforces.com/gym/100827/attachments Hill Number Time Limits:  5000 MS   Memory Limits:  200000 KB 64-bit interger IO format:  %lld   Java class name:  Main Description A Hill Number is a number whose digits possibly rise and then possibl…
E. Number With The Given Amount Of Divisors time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Given the number n, find the smallest positive integer which has exactly n divisors. It is guara…
题目链接:http://codeforces.com/problemset/problem/27/E 暴力 //#pragma comment(linker, "/STACK:102400000, 102400000") #include <algorithm> #include <iostream> #include <cstdlib> #include <cstring> #include <cstdio> #includ…
http://codeforces.com/contest/235/problem/E 远距离orz......rng_58 证明可以见这里(可能要FQ才能看到) 还是copy一下证明吧: 记 $$f(a,b,c)=\sum\limits_{i=1}^{a}\sum\limits_{j=1}^{b}\sum\limits_{k=1}^{c}d(ijk)$$ 和 $$g(a,b,c)=\sum\limits_{gcd(i,j)=gcd(j,k)=gcd(i,k)=1}\left \lfloor \…
题目链接:http://codeforces.com/problemset/problem/1151/E 题目大意: n个人排成一个序列,标号为 1~n,第 i 个人的学习成绩为 ai,现在要选出学习成绩在区间 [l, r] 中的人,被选出的人如果他们在序列中相邻,就将他们划分到一个小组,设 f(l, r) 表示一共可以分出的组的个数.求这个和:$ \sum_{l = 1}^n \sum_{r = 1}^n f(l, r) $. 分析: 对于每一个学生,都有作为它所在小组区间左端点和右端点的时候…
Number Transformation 我们能发现这个东西是以2 - k的lcm作为一个循环节, 然后bfs就好啦. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define PLL pair<LL, LL> #define PLI pair<LL, int> #define PII pair<int,…
题目传送门 传送门I 传送门II 题目大意 给定一个$n\times m$的网格,每个格子上要么填$1$,要么填$-1$,有$k$个位置上的数是已经填好的,其他位置都是空的.问有多少种填法使得任意一行或一列上的数的乘积为$-1$. $1 \leqslant n, m \leqslant 10^{3}$,$1 \leqslant k < \max (n, m)$. $k$的范围醒目.那么意味着至少存在一行或者一列为空. 假设空的是一行.那么剩下的行只需要满足那一行的乘积为$-1$,而空的这一行对应…
dp(a,b,c,p) = sigma ( dp(a/p^i,b/p^j,c/p^k) * ( 1+i+j+k) ) 表示用小于等于p的素数去分解的结果有多少个 E. Number Challenge time limit per test 3 seconds memory limit per test 512 megabytes input standard input output standard output Let's denote d(n) as the number of divi…