题意:在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. 第4章 ext文件系统机制原理剖析

    将磁盘进行分区,分区是将磁盘按柱面进行物理上的划分.划分好分区后还要进行格式化,然后再挂载才能使用(不考虑其他方法).格式化分区的过程其实就是创建文件系统. 文件系统的类型有很多种,如CentOS 5 ...

  2. kubernetes系列(一)安装和配置

    谈到kubernetes(或者说k8s)不得不提到云计算.虚拟化以及容器技术,相关介绍网上一大堆,不再赘述.而kubernetes的出现就是为了高效的管理云端运行的docker容器. 环境 docke ...

  3. Django之FBV与CBV

    一.FBV与CBV FBV(function based views),即基于函数的视图:CBV(class based views),即基于类的视图,也是基于对象的视图.当看到这个解释时,我是很萌的 ...

  4. [转]Angular 4 *ngIf/Else

    本文转自:http://tylerscode.com/2017/03/angular-4-ngifelse/ As you may know it wasn’t that many months ag ...

  5. jsonp请求

    发起一个jsonp请求 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type&q ...

  6. vue-cli脚手架搭建项目简单入门一

    搭建系统: Windows系统 简单了解Node.js.npm,安装Node.js,下载网址:http://nodejs.cn/download/ 查看node,npm安装成功与否.打开cmd命令行, ...

  7. [android] 手机卫士自定义滚动控件

    TextView控件设置单行显示 android:singleLine=”true” 设置TextView开始的位置显示省略号,android:ellipsize=”start” 设置滚动属性,and ...

  8. Tests of the Equality of Two Means

    Introduction In this lesson, we'll continue our investigation of hypothesis testing. In this case, w ...

  9. Java集合之LinkedList源码分析

    概述 LinkedLIst和ArrayLIst一样, 都实现了List接口, 但其内部的数据结构不同, LinkedList是基于链表实现的(从名字也能看出来), 随机访问效率要比ArrayList差 ...

  10. linux学习笔记-安装配置使用clamav杀毒软件

    我的邮箱地址:zytrenren@163.com欢迎大家交流学习纠错! 1.安装clamav 2.更新病毒库 # freshclam 如果更新不了,或者更新特别慢,可以手动下载病毒库文件,放到/var ...