C:这道题没做出来...写了个类似极角排序的东西被卡掉了...事实上暴力就行了,因为如果在二维平面内那么最多只能有4个点,因为每个象限只能有一个点,然后这里拓展一下就是最多只能有2*k个点,k是维数,所以大概枚举2*k=10就跳出循环了

#include<bits/stdc++.h>
using namespace std;
const int N = ;
const double pi = acos(-);
struct points {
double a[];
points friend operator - (points a, points b)
{
points ret;
for(int i = ; i < ; ++i) ret.a[i] = a.a[i] -b.a[i];
return ret;
}
} p[N];
int n, ans;
int mark[N];
double calc(points a, points b)
{
double ret = ;
for(int i = ; i < ; ++i) ret += a.a[i] * b.a[i];
return ret;
}
int main()
{
scanf("%d", &n);
for(int i = ; i <= n; ++i)
for(int j = ; j < ; ++j)
scanf("%lf", &p[i].a[j]);
ans = n;
for(int i = ; i <= n; ++i)
for(int j = ; j <= n && !mark[i]; ++j) if(i != j)
for(int k = ; k <= n; ++k) if(i != j && k != j)
{
points a = p[j] - p[i], b = p[k] - p[i];
if(calc(a, b) > )
{
mark[i] = , --ans;
break;
}
}
cout << ans << endl;
for(int i = ; i <= n; ++i) if(!mark[i]) cout << i << endl;
return ;
}

D:暴力枚举GCD,然后贪心计算一下,具体看程序,gcd的题见到过有几种方法,1.gcd个数不超过log个,2.修改可以差分,3.类似莫比乌斯反演的容斥,4.像这样暴力枚举。大概也逃不出这几种方法了吧

#include<bits/stdc++.h>
using namespace std;
const int N = ;
int n, x, y, m;
int mark[N], a[N];
long long s[N], c[N];
long long ans = 1ll << ;
int main()
{
cin >> n >> x >> y;
for(int i = ; i <= n; ++i) scanf("%d", &a[i]), ++ c[a[i]], s[a[i]] += a[i], m = max(m, a[i]);
for(int i = ; i <= ; ++i) c[i] += c[i - ], s[i] += s[i - ];
for(int i = ; i <= ; ++i)
{
long long sum = ;
for(int j = i; j <= + i; j += i)
{
int p = max(j - i + , j - (x / y));
sum += ((c[j] - c[p - ]) * (long long)j - s[j] + s[p - ]) * (long long)y;
sum += (c[p - ] - c[j - i]) * (long long)x;
}
// printf("i = %d sum = %lld\n", i, sum);
ans = min(ans, sum);
}
cout << ans << endl;
return ;
}

codeforces round#432 div2的更多相关文章

  1. Codeforces Round #539 div2

    Codeforces Round #539 div2 abstract I 离散化三连 sort(pos.begin(), pos.end()); pos.erase(unique(pos.begin ...

  2. 【前行】◇第3站◇ Codeforces Round #512 Div2

    [第3站]Codeforces Round #512 Div2 第三题莫名卡半天……一堆细节没处理,改一个发现还有一个……然后就炸了,罚了一啪啦时间 Rating又掉了……但是没什么,比上一次好多了: ...

  3. Codeforces Round#320 Div2 解题报告

    Codeforces Round#320 Div2 先做个标题党,骗骗访问量,结束后再来写咯. codeforces 579A Raising Bacteria codeforces 579B Fin ...

  4. Codeforces Round #564(div2)

    Codeforces Round #564(div2) 本来以为是送分场,结果成了送命场. 菜是原罪 A SB题,上来读不懂题就交WA了一发,代码就不粘了 B 简单构造 很明显,\(n*n\)的矩阵可 ...

  5. Codeforces Round #361 div2

    ProblemA(Codeforces Round 689A): 题意: 给一个手势, 问这个手势是否是唯一. 思路: 暴力, 模拟将这个手势上下左右移动一次看是否还在键盘上即可. 代码: #incl ...

  6. Codeforces Round #626 Div2 D,E

    比赛链接: Codeforces Round #626 (Div. 2, based on Moscow Open Olympiad in Informatics) D.Present 题意: 给定大 ...

  7. CodeForces Round 192 Div2

    This is the first time I took part in Codeforces Competition.The only felt is that my IQ was contemp ...

  8. Codeforces Round #359 div2

    Problem_A(CodeForces 686A): 题意: \[ 有n个输入, +\space d_i代表冰淇淋数目增加d_i个, -\space d_i表示某个孩纸需要d_i个, 如果你现在手里 ...

  9. Codeforces Round #360 div2

    Problem_A(CodeForces 688A): 题意: 有d天, n个人.如果这n个人同时出现, 那么你就赢不了他们所有的人, 除此之外, 你可以赢他们所有到场的人. 到场人数为0也算赢. 现 ...

随机推荐

  1. 转载:K-means聚类算法

    转载地址:http://www.cnblogs.com/jerrylead/archive/2011/04/06/2006910.html K-means也是聚类算法中最简单的一种了,但是里面包含的思 ...

  2. x1 carbon 扩展屏 模糊

    x1 carbon 扩展屏 模糊,扩展屏是dell的屏,分辨率最大是1920*1080, x1最大是2560*1440. 不论是通过DP mini转VGA,还是HDMI,输出都是模糊,只有复制屏幕的时 ...

  3. JAVA中json转换为集合(对象)之间的相互转换

    字符串转换为json对象: String strResult = RestUtil.getRestContent(url+"/service/peccancy/myOrderList&quo ...

  4. Assigning to "id<CALayerDelegate> _Nullable" from incompatible type "ZXCapture *const __strong" 的警告提示信息

    该警告提示信息,是说,设置了代理对象,但是并没有继承它的代理.下图中,可以看出,警告信息提示我们没有继承“CALayerDelegate”的代理. 解决方法,很简单,(在 @interface 文件中 ...

  5. Codeforces Manthan, Codefest 18 (rated, Div. 1 + Div. 2) D,E

    D. Valid BFS? time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

  6. C/C++ (一)

    c语言中的逻辑运算符都是短路运算,一旦能够确定整个表达式的值就不再计算,配合c的定义的灵活性,可以写出很多漂亮的程序. 例如 如果要在一个长为n的数列s中找到第k个没被标记过的数 for(i=1,j= ...

  7. 原来,表名和字段名不能在pdo中“参数化查询”

    https://stackoverflow.com/questions/182287/can-php-pdo-statements-accept-the-table-or-column-name-as ...

  8. Nuget公布Dll

    今天要開始写ViewModel了,写完之后系统里的ViewModel都汇总到我这里.然后由我负责ViewModel的公布跟维护,所以Nuget公布Dll就要熟练啦~ 一,安装工具 1.Nuget Pa ...

  9. 微信小程序之 Classify(商品属性分类)

    1.项目目录 2.逻辑层 broadcast.js // pages/broadcast/broadcast.js Page({ /** * 页面的初始数据 */ data: { firstIndex ...

  10. Wi-Fi无线网络(WPA2加密)快速破解 ——某公司无线设备安全隐患报告

    Wi-Fi无线网络(WPA2加密)快速破解 --某公司无线设备安全隐患报告 评估人:阿牛 2013年12月12日 文件夹 一. 导言 2 二. 背景 2 三. 无线产品应当採取的安全策略 3 四. 存 ...