题意:在1到n的气球中,在不同的区域中涂颜色,问每个气球涂几次。

#include<cstdio>
int num[100010];
int main()
{
 int n, x, y;;
 while (scanf("%d", &n), n)
 {
  for (int i = 0; i < n; i++)
  {
   scanf("%d%d", &x, &y);
   num[x] += 1; num[y + 1] -= 1;
  }
  for (int i = 2; i <= n + 1; i++)
   num[i] += num[i - 1];
  printf("%d", num[1]); num[1] = 0;
  for (int i = 2; i <= n; i++)
  {
   printf(" %d", num[i]); num[i] = 0;
  }
  printf("\n");
 }

}

Color the ball HDU - 1556 (非线段树做法)的更多相关文章

  1. Color the ball HDU - 1556 (线段树)

    思路:线段树,区间更新 #include<iostream> #include<vector> #include<string> #include<cmath ...

  2. hdu 1556 Color the ball(非线段树做法)

    #include<stdio.h> #include<string.h> ]; int main() { int n,i; int a,b; while(scanf(" ...

  3. HDU 1556【线段树区间更新】

    这篇lazy讲的很棒: https://www.douban.com/note/273509745/ if(tree[rt].l == l && r == tree[rt].r) 这里 ...

  4. A - Color the ball HDU - 1556 (差分数组+前缀和)

    思路等引自博客 https://blog.csdn.net/johnwayne0317/article/details/84928568 对数组a[7]: a[0]=1; = d[0] a[1]=1; ...

  5. hdu 4031 attack 线段树区间更新

    Attack Time Limit: 5000/3000 MS (Java/Others)    Memory Limit: 65768/65768 K (Java/Others)Total Subm ...

  6. hdu 4288 离线线段树+间隔求和

    Coder Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Su ...

  7. hdu 3016 dp+线段树

    Man Down Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total S ...

  8. HDU 4605 Magic Ball Game(可持续化线段树,树状数组,离散化)

    Magic Ball Game Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  9. Necklace HDU - 3874 (线段树/树状数组 + 离线处理)

    Necklace HDU - 3874  Mery has a beautiful necklace. The necklace is made up of N magic balls. Each b ...

随机推荐

  1. loadrunner:Action.c(4): Error -27796: Failed to connect to server "192.168.66.3:8080": [10060] Connection timed out

    Action.c(4): Error -27796: Failed to connect to server "192.168.66.3:8080": [10060] Connec ...

  2. ASP.NET Core Identity 实战(2)——注册、登录、Claim

    上一篇文章(ASP.NET Core Identity Hands On(1)--Identity 初次体验)中,我们初识了Identity,并且详细分析了AspNetUsers用户存储表,这篇我们将 ...

  3. c语言学习笔记-do......while

    我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 一.do......while函数意义 循环执行(人机交互) 二.do......while函数结构 do{ 语句1: 语句2: ...

  4. jQuery:SP.NET Autocomplete Textbox Using jQuery, JSON and AJAX

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="jQueryAutocomp ...

  5. 测试思想-流程规范 SVN代码管理与版本控制

    SVN代码管理与版本控制 by:授客 QQ:1033553122   欢迎加入软件性能测试交流群(QQ群):7156436   目录 一. 二. 三. 四. 五. 六. 七. 一. 创建根目录 创建一 ...

  6. spring BeanFactory及ApplicationContext中Bean的生命周期

    spring bean 的生命周期 spring BeanFactory及ApplicationContext在读取配置文件后.实例化bean前后.设置bean的属性前后这些点都可以通过实现接口添加我 ...

  7. [20170615]执行dbms_sqldiag.dump_trace看执行计划.txt

    [20170615]执行dbms_sqldiag.dump_trace看执行计划.txt --//上午在想查看10053执行计划时使用包时出现如下提示: SCOTT@book> @ &r ...

  8. ADOBE ACROBAT 去除Explorer右键菜单

    运行以下命令: regsvr32 -u "C:\Program Files (x86)\Adobe\Acrobat 10.0\Acrobat Elements\ContextMenu64.d ...

  9. python第三十五天-----作业完成--学校选课系统

    选课系统:角色:学校.学员.课程.讲师要求:1. 创建北京.上海 2 所学校2. 创建linux , python , go 3个课程 , linux\py 在北京开, go 在上海开3. 课程包含, ...

  10. 前端使用 validate , 根据条件进行动态的验证添加

    需求如下: 审核操作的时候,选择“通过” 就不需要验证审核意见,但是选择的是“不通过”,那么需要进行审核意见验证 <script> $(function () { InitValidate ...