摘要:
#include#includeusing namespace std;const int maxn = 500 + 5;char map[maxn][maxn];int dirx[4] = {1, 0, 0, -1};int diry[4] = {0, 1, -1, 0};int n, m, d;int ex, ey;struct point{ int x; int y; int v; const bool operator a.v升序, v a.v; }};int bfs(int x, int y){ point q1, q2; priority_queueQ; q1.x = x; q.. 阅读全文
摘要:
#include#includeusing namespace std;const int maxn = 10000 + 10;int p[maxn];int main(){ int n; while(cin>>n){ for(int i=0; i>p[i]; } sort(p, p + n); //从小到大排序 int sum = 1; for(int i=0; i<n; i++){ if(sum < p[i]) break; sum += p[i]; } cout<<sum<<endl; } return 0;} 阅读全文