解题思路:
思路题目给出来了,照着写就完事了
参考代码:
#include"iostream" #include"algorithm" using namespace std; int ans[1001]; int main(){ int n,m; cin>>n>>m; for(int i=0;i<n;i++) cin>>ans[i]; sort(ans,ans+n); int sum=0; for(int i=0;i<n-m;i++){ ans[i+m]+=ans[i]; sum+=ans[i]; } cout<<sum<<endl; }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题8.6 (C语言代码)浏览:572 |
川哥的吩咐 (C++代码)浏览:1008 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:629 |
简单的for循环浏览:1408 |
WU-格式化数据输出 (C++代码)浏览:1194 |
剪刀石头布 (C语言代码)浏览:1747 |
罗列完美数 (C语言代码)浏览:491 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:575 |
1025题 初学者,求帮忙看下,不知道哪错了浏览:316 |
简单的a+b (C语言代码)浏览:655 |