编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#22534 #1020. jwp的采购之旅 Compile Error 0 0 ms 0 K Python 3 / 839 B 机类910-尚锦奥 2020-02-13 11:44:03
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<queue>
#include<vector>
#include<stack>
#include<set>
#include<cmath>
#include<bitset>
#define lson node<<1
#define rson node<<1|1
using namespace std;
#define ll long long
const ll maxn=5e5+10;
ll read()
{
    char c=getchar();
    ll x=0;
    ll flag=1;
    while(c<'0'||c>'9')
    {
        if(c=='-')flag=-1;
        c=getchar();
    }
    while(c>='0'&&c<='9')
    {
        x=x*10+c-48;
        c=getchar();
    }
    x*=flag;
    return x;
}
int a[maxn];
int n;
int cnt=0,m;
priority_queue<int,vector<int>,greater<int> >s;
int main()
{
	n=read();m=read();
	for(int i=1;i<=n;i++)
	{
		s.push(read());
	}
	while(!s.empty()&&m>=s.top())
	{
		cnt++;m-=s.top();s.pop();
	}
	printf("%d",cnt);
	return 0;
}

编译信息

  File "a.py", line 45
    while(!s.empty()&&m>=s.top())
          ^
SyntaxError: Unknown character