Educational Codeforces Round 30 A
Chores
AC代码:
#include "iostream" #include "iomanip" #include "string.h" #include "stack" #include "queue" #include "string" #include "vector" #include "set" #include "map" #include "algorithm" #include "stdio.h" #include "math.h" #pragma comment(linker, "/STACK:102400000,102400000") #define bug(x) cout<<x<<" "<<"UUUUU"<<endl; #define mem(a,x) memset(a,x,sizeof(a)) #define step(x) fixed<< setprecision(x)<< #define mp(x,y) make_pair(x,y) #define pb(x) push_back(x) #define ll long long #define endl ("\n") #define ft first #define sd second #define lrt (rt<<1) #define rrt (rt<<1|1) using namespace std; const ll mod=1e9+7; const ll INF = 1e18+1LL; const int inf = 1e9+1e8; const double PI=acos(-1.0); const int N=1e5+100;int n,k,x,a[N],ans; int main(){ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);cin>>n>>k>>x;for(int i=1; i<=n; ++i){cin>>a[i];}sort(a+1,a+1+n);for(int i=1; i<=n-k; ++i){ans+=a[i];}ans+=k*x;cout<<ans<<endl;return 0; }
转载于:https://www.cnblogs.com/max88888888/p/7666344.html
Educational Codeforces Round 30 A相关推荐
- Educational Codeforces Round 30 C
Strange Game On Matrix 题意:给出n*m的0 1矩阵,在每一列第一个1后面找k-1个数相加,可以将1修改为0,求和的最大值并且修改的最少次数 思路:暴力过去n^3,或者求列的前缀 ...
- Educational Codeforces Round 30 A[水题/数组排序]
A. Chores time limit per test 2 seconds memory limit per test 256 megabytes input standard input out ...
- Educational Codeforces Round 90 (Rated for Div. 2)(A, B, C, D, E)
Educational Codeforces Round 90 (Rated for Div. 2) Donut Shops 思路 分三种情况: a==c/ba == c / ba==c/b这个时候两 ...
- Educational Codeforces Round 32 G. Xor-MST 01tire + 分治 + Boruvka
传送门 文章目录 题意: 思路: 题意: 给你一个长度为nnn序列aaa,每两个点之间的边权为ai⊕aja_i\oplus a_jai⊕aj,问你最小生成树的权值是多少. n≤2e5,ai< ...
- Educational Codeforces Round 76 (Rated for Div. 2) F. Make Them Similar 折半搜索
传送门 文章目录 题意: 思路: 题意: 思路: 一个显然的思路就是2302^{30}230枚举所有的xxx,让后再检查,这个复杂度显然不能接受. 又发现对于每个位置它取多少不受其他位置限制,满足可拼 ...
- Educational Codeforces Round 48
Educational Codeforces Round 48 C.Vasya And The Mushrooms 思路很简单,走法有一个统一形式就是先上下走,然后到某个位置左右一个来回.然后就推一下 ...
- Educational Codeforces Round 24 E. Card Game Again(双指针)
题目链接:Educational Codeforces Round 24 E. Card Game Again 题意: 给你n个数和一个数k. 现在每次可以拿掉前x个数,后y个数,剩下的数的乘积要能被 ...
- Educational Codeforces Round 25 G. Tree Queries
题目链接:Educational Codeforces Round 25 G. Tree Queries 题意: 给你一棵树,一开始所有的点全是黑色,有两种操作. 1 x 将x这个点变为黑色,保证第一 ...
- Educational Codeforces Round 126 (Rated for Div. 2)(A-E)
A-Array Balancing 题意:给定两个数组a,b,a数组第i个数可以和b数组的第i个数交换,最终求 a1−a2|+|a2−a3|+⋯+|an−1−an||a1−a2|+|a2−a3|+⋯+ ...
最新文章
- Unity3D 入门 游戏开发 Unity3D portal game development
- 重构-打造爱因斯坦谜题最快算法
- mysql设置定位慢查询_mysql优化——定位慢查询
- Linux学习笔记——Centos6.4
- 在线的SA 绘图工具-Mockups
- C++ 类的成员函数指针 ( function/bind )
- 境外WiFi市场持续升温 2016年或迎普及元年
- phpcmsv9 更换域名出现页面无法访问后怎么办
- 基于VS2015的C#的GDAl环境配置
- java返回语句_Java中return的语句
- SPSSAU进行方差分析
- 汉字风格迁移篇--基于生成对抗网络的无监督字体风格转换模型
- 千帆竞发百日角逐,玻色量子荣获“创业北京”一等奖
- mysql indentify_ORA-01157: cannot identify/lock data file导致表空间无法on
- php依赖注入框架pimple中文文档
- 2.垃圾收集器与内存分配策略
- 投标书如何写?(转)
- 聆听第18期贡献者荣誉榜发布,体验落地才是王道
- SuperMap地图发布
- 网管的自我修养-电脑维护
热门文章
- 9周的项目实训从今天就开始了,
- 解析 WEB 中所有 URL 的简单牛B代码,先保存起来,方式将来找不到了
- Android Thread interrupt 中断JAVA线程(转)
- CListCtrl使用技巧
- WDSL文件中的XML元素
- sql输出表中重复数据
- 微信小程序 - this.triggerEvent()
- Python初探——sklearn库中数据预处理函数fit_transform()和transform()的区别
- libcurl网络连接使用tcp/ip
- 面向过程(或者叫结构化)分析方法与面向对象分析方法到底区别在哪里?请根据自己的理解简明扼要的回答。...