杭电ACM2015--偶数求和
偶数求和
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 120940 Accepted Submission(s): 50025
4 2
这道题感觉不能好好理解题目T T
会卡的地方就在 每m个数求平均值,这里是有m个数,之前求的数不算进来
#include<stdio.h>
int main()
{
int n,m;
while(~ scanf("%d %d",&n,&m)) {
int num[],sum=,count=;
for(int i=; i<=n; i++) {
num[i]=i*;
sum+=num[i];
count++;
if(count==m) {
if(i==n)
printf("%d",sum/m);
else
printf("%d ",sum/m); count=;
sum=;
}
else if(i==n) {
printf("%d",sum/count);
}
}
printf("\n");
}
return ;
}
杭电ACM2015--偶数求和的更多相关文章
- 杭电ACM 偶数求和
偶数求和 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- 2015 偶数求和 AC 杭电
偶数求和 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submi ...
- 杭电ACM分类
杭电ACM分类: 1001 整数求和 水题1002 C语言实验题——两个数比较 水题1003 1.2.3.4.5... 简单题1004 渊子赛马 排序+贪心的方法归并1005 Hero In Maze ...
- acm入门 杭电1001题 有关溢出的考虑
最近在尝试做acm试题,刚刚是1001题就把我困住了,这是题目: Problem Description In this problem, your task is to calculate SUM( ...
- 杭电ACM(1002) -- A + B Problem II 大数相加 -提交通过
杭电ACM(1002)大数相加 A + B Problem II Problem DescriptionI have a very simple problem for you. Given two ...
- 杭电dp题集,附链接还有解题报告!!!!!
Robberies 点击打开链接 背包;第一次做的时候把概率当做背包(放大100000倍化为整数):在此范围内最多能抢多少钱 最脑残的是把总的概率以为是抢N家银行的概率之和- 把状态转移方程写成了f ...
- 2017杭电ACM集训队单人排位赛 - 6
2017杭电ACM集训队单人排位赛 - 6 排名 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 59 1 X X 1 1 X X 0 1 ...
- 杭电acm 1002 大数模板(一)
从杭电第一题开始A,发现做到1002就不会了,经过几天时间终于A出来了,顺便整理了一下关于大数的东西 其实这是刘汝佳老师在<算法竞赛 经典入门 第二版> 中所讲的模板,代码原封不动写上的, ...
- 杭电OJ——1198 Farm Irrigation (并查集)
畅通工程 Problem Description 某省调查城镇交通状况,得到现有城镇道路统计表,表中列出了每条道路直接连通的城镇.省政府"畅通工程"的目标是使全省任何两个城镇间都可 ...
随机推荐
- GameFreamWork框架----事件系统的应用
事件系统用途广泛,对处理玩家数据有很大帮助(玩家金币,经验,等级),让数据多次调用,降低耦合 在unity中应用(以玩家金币发生变化来演示); 1).注册监听 2).移出监听 3).金币发生变化的时候 ...
- react 引用 layer (防忘记)
1.先到 百度静态资源公共库 (http://cdn.code.baidu.com/)找到jquery和layer地址 2.找到./public/index.html 引入jquery和layer 3 ...
- Lesson 25 Do the English speak English?
Text I arrived London at last. The railway station was big, black and dark. I did not know the way t ...
- 1.1 What is the plug-in?
A game center, such as Lianzhong in China, supports hundreds of games such as Chess, Bridges, ...
- centos7启动流程(从加电开始)
图片来自于https://blog.csdn.net/qq_27754983/article/details/75212666 1. UEFI或BIOS启动 服务器加电后,CPU 自动重置成初始状态, ...
- [Swift]LeetCode393. UTF-8 编码验证 | UTF-8 Validation
A character in UTF8 can be from 1 to 4 bytes long, subjected to the following rules: For 1-byte char ...
- [Swift]LeetCode445. 两数相加 II | Add Two Numbers II
You are given two non-empty linked lists representing two non-negative integers. The most significan ...
- [Swift]LeetCode766. 托普利茨矩阵 | Toeplitz Matrix
A matrix is Toeplitz if every diagonal from top-left to bottom-right has the same element. Now given ...
- [Swift]LeetCode823. 带因子的二叉树 | Binary Trees With Factors
Given an array of unique integers, each integer is strictly greater than 1. We make a binary tree us ...
- RabbitMQ 学习笔记
环境: MacOS 10.14 Node.js 8.9.1 零.背景 目前有个上线应用会接受多个请求,且每个请求的处理时间可能很久,可能到数小时,所以就想采用异步机制,至于复杂的运算就用消息队列(MQ ...