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. SPOJ1812 - Longest Common Substring II(LCS2)

    Portal,Portal to 洛谷 Description 给出\(n(n\leq10)\)个仅包含小写字母的字符串\(s_1..s_n(|s_i|\leq10^5)\),求这些字符串的最长公共子 ...

  2. msp430入门编程46

    msp430中C语言的人机交互--基于状态机菜单

  3. cobbler ks文件解释--转载

    cobbler中ks.cfg文件配置详解        许多系统管理员宁愿使用自动化的安装方法来安装红帽企业 Linux.为了满足这种需要,红帽创建了kickstart安装方法.使用kickstart ...

  4. PAT (Advanced Level) 1032. Sharing (25)

    简单题,不过数据中好像存在有环的链表...... #include<iostream> #include<cstring> #include<cmath> #inc ...

  5. Atom安装Markdown编辑器

    1.安装插件 2.打开/关闭实时渲染: [Ctrl]+[Shift]+[M] 3.[增强]安装同步滚动插件(markdown-scroll-sync) 4.[增强]安装代码增强插件(language- ...

  6. L0、L1与L2范数

    监督机器学习问题无非就是“minimize your error while regularizing your parameters”,也就是在正则化参数的同时最小化误差.最小化误差是为了让我们的模 ...

  7. 【深度探索c++对象模型】Function语义学之虚函数

    虚函数的一般实现模型:每一个class有一个virtual table,内含该class中的virtual function的地址,然后每个object有一个vptr,指向virtual table. ...

  8. POST &amp; GET &amp; Ajax 全解

    GET&POST&Ajax 全解 一.POST和GET的差别 GET:GET方法提交数据不安全,数据置于请求行.客户段地址栏可见:GET方法提交的数据限制大小在255个字符之内.參数直 ...

  9. 阿里云 oss 小文件上传进度显示

    对阿里云OSS上传小文件时的进度,想过两个方法:一是.通过多线程监測Inputstream剩余的字节数来计算,可是由于Inputstream在两个线程中共用,假设上传线程将Inputstream关闭, ...

  10. Android实战简易教程-第四十枪(窃听风云之短信监听)

    近期在做监听验证码短信自己主动填入的功能,无意间想到了一个短信监听的办法. 免责声明:短信监听本身是一种违法行为,这里仅仅是技术描写叙述.请大家学习技术就可以.(哈哈) 本实例是基于bmob提供的后台 ...