• 【CF1015A】Points in Segments(签到)


    题意:有一条上面有n个点的数轴,给定m次操作,每次覆盖(x[i],y[i]),求最后没有被覆盖过的点的数量与他们的编号

    n,m<=100

    思路:

     1 #include<cstdio>
     2 #include<cstring>
     3 #include<string>
     4 #include<cmath>
     5 #include<iostream>
     6 #include<algorithm>
     7 #include<map>
     8 #include<set>
     9 #include<queue>
    10 #include<vector>
    11 using namespace std;
    12 typedef long long ll;
    13 typedef unsigned int uint;
    14 typedef unsigned long long ull;
    15 typedef pair<int,int> PII;
    16 typedef vector<int> VI;
    17 #define fi first
    18 #define se second 
    19 #define MP make_pair
    20 
    21 const int N=1100;
    22 int a[N],n,m;
    23 
    24 int read()
    25 { 
    26    int v=0,f=1;
    27    char c=getchar();
    28    while(c<48||57<c) {if(c=='-') f=-1; c=getchar();}
    29    while(48<=c&&c<=57) v=(v<<3)+v+v+c-48,c=getchar();
    30    return v*f;
    31 }
    32  
    33 int main()
    34 {
    35   //freopen("1.in","r",stdin);
    36   //freopen("1.out","w",stdout);
    37   scanf("%d%d",&n,&m);
    38   for(int i=1;i<=n;i++) 
    39   {
    40       int x,y;
    41     scanf("%d%d",&x,&y);
    42     for(int j=x;j<=y;j++) a[j]=1;
    43   }
    44   int ans=0;
    45   for(int i=1;i<=m;i++) ans+=a[i];
    46   printf("%d
    ",m-ans);
    47   for(int i=1;i<=m;i++)
    48    if(!a[i]) printf("%d ",i); 
    49   return 0;
    50 }
  • 相关阅读:
    XAML中的戏法
    提前预览Visual Studio 2010
    大道至简
    Windows Service下的MessageBox
    WPF中使用Expression Encoder SDK开发流媒体
    使用latex
    [zz]2D动画制作工具比较
    android platform_frameworks_base
    Fast and easy high resolution fractals with a pixel shader
    Bézier Surface
  • 原文地址:https://www.cnblogs.com/myx12345/p/9842904.html
Copyright © 2020-2023  润新知