c++stl库不是不允许么?!!!!!

如题,为什么用stl库可以ac呢?!

2 条评论

  • @ 2016-03-12 16:05:23

    编译成功

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

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

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

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

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

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

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

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

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

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

    Accepted, time = 90 ms, mem = 704 KiB, score = 100
    #include <iostream>
    #include <queue>
    using namespace std;
    int main(){

    priority_queue<int,vector<int>,greater<int> > Q;
    int n,k,i;
    cin>>n;
    for(i=0;i<n;i++){
    cin>>k;
    Q.push(k);
    }
    int js=0;
    for(i=0;i<n-1;i++){
    int a=Q.top();
    Q.pop();
    int b=Q.top();
    Q.pop();
    js+=a+b;
    Q.push(a+b);
    }
    cout<<js<<endl;
    system("pause");
    return 0;

    }

  • @ 2013-08-05 17:43:31

    早就开放了哦~~

  • 1

信息

ID
1097
难度
6
分类
贪心 点击显示
标签
递交数
23906
已通过
6330
通过率
26%
被复制
41
上传者