A - Acperience HDU - 5734 题意: 给你一个加权向量,需要我们找到一个二进制向量和一个比例因子α,使得|W-αB|的平方最小,而B的取值为+1,-1,我们首先可以想到α为输入数据的平均值,考虑到是平方和,然后化简表达式,可以得到一个化简的式子,用n通分,可以做到没有除法,然后分子分母化简到互质. #define _CRT_SECURE_NO_WARNINGS #include<cstdio> #include<cstring> #include<iom…
2016 Al-Baath University Training Camp Contest-1 A题:http://codeforces.com/gym/101028/problem/A 题意:比赛初始值是1500,变化了几次,得到的正确结果和bug后的是否相等.(Tourist大佬好 Y(^o^)Y) #include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { in…
我只能说: A Boring Question 下面公式重复了一行 \[ \sum\_{0\leq k\_{1},k\_{2},\cdots k\_{m}\leq n}\prod\_{1\leq j< m}\binom{k\_{j+1}}{k\_{j}} \\\ =\sum\_{0\leq k\_{1}\leq k\_{2}\leq\cdots \leq k\_{m}\leq n}\prod\_{1\leq j< m}\binom{k\_{j+1}}{k\_{j}} \\\ =\sum\_{k…
Description ACM-SCPC-2017 is approaching every university is trying to do its best in order to be the Champion, there are n universities, the ith of them has exactly ai contestants. No one knows what is the official number of contestants in each team…
Description Zaid has two words, a of length between 4 and 1000 and b of length 4 exactly. The word a is 'good' if it has a substring which is equal tob. However, a is 'almost good' if by inserting a single letter inside of it, it would become 'good'.…
Description Tourist likes competitive programming and he has his own Codeforces account. He participated in lots of Codeforces Rounds, solved so many problems and became "Legendary Grand Master" (the highest rank on Codeforces). One day, he logg…
---------- HDU 5288 OO’s Sequence 题意 给定一个数列(长度<$10^5$),求有多少区间[l,r],且区间内有多少数,满足区间内其它数不是他的约数. 数的范围$[1,10000]$.结果对$10^9+7$取模. Solution 首先可以预处理每个数的约数有哪些.对每个数存下它的位置有哪些. 然后可以枚举每一个位置,利用二分找到左边第一个是它约数的数,和右边第一个是他约数的数. 假设向左有L个数,向右有R个数.那么ans应该加上(L*R). 时间复杂度$O(n*…
题目链接:5288-5299 HDU5288 题解原文链接:我是链接…
题目链接:http://codeforces.com/problemset/gymProblem/101028/I I. March Rain time limit per test 2 seconds memory limit per test 64 megabytes input standard input output standard output It is raining again! Youssef really forgot that there is a chance of…
总的来说,这次的题目比较水,然而菜菜的我并没有把所有题目都做完,话不多说,直接来干货: A:Next Alphabet 题目链接:https://atcoder.jp/contests/abc151/tasks/abc151_a 题目描述:Given is a lowercase English letter C that is not z. Print the letter that follows C in alphabetical order. 大致解读:给你一个小写字母,输出这个小写字母…