为何90 已经加了一了

测试数据 #0: WrongAnswer, time = 15 ms, mem = 564 KiB, score = 0

测试数据 #1: Accepted, time = 0 ms, mem = 564 KiB, score = 10

测试数据 #2: Accepted, time = 0 ms, mem = 568 KiB, score = 10

测试数据 #3: Accepted, time = 0 ms, mem = 568 KiB, score = 10

测试数据 #4: Accepted, time = 0 ms, mem = 568 KiB, score = 10

测试数据 #5: Accepted, time = 0 ms, mem = 568 KiB, score = 10

测试数据 #6: Accepted, time = 0 ms, mem = 564 KiB, score = 10

测试数据 #7: Accepted, time = 0 ms, mem = 572 KiB, score = 10

测试数据 #8: Accepted, time = 0 ms, mem = 568 KiB, score = 10

测试数据 #9: Accepted, time = 0 ms, mem = 568 KiB, score = 10

#include <iostream>
using namespace std;
bool a[10002];
int main()
{
    int q[102];
    int z[102];
    int l;cin>>l;
    int m;cin>>m;

    for(int i=1;i<=m;i++)
    {cin>>q[i]>>z[i];}
    for(int i=1;i<=m;i++)
        for(int j=q[i];j<=z[i];j++)
            {a[j]=true;}
    int counter=0;
    for(int i=1;i<=l+1;i++)
    if(a[i]==false)
    {counter++; }
    
    cout<<counter;
}

2 条评论

  • @ 2016-02-22 01:33:43

    题目说道路上的结点是从0到L的。所以你最后统计答案的时候应该

    int counter=0;
    for(int i=0;i<=l;i++)
    if(a[i]==false)
    counter++;

  • @ 2016-02-21 11:33:24

    加一?

  • 1

信息

ID
1103
难度
4
分类
模拟 点击显示
标签
递交数
14316
已通过
6534
通过率
46%
被复制
54
上传者