求大佬帮忙 输出值大了

P2816 宋荣子搭积木

我也是
by 高天昊 @ 2017-07-28 10:00:41


```cpp #include<cstdio> #include<iostream> #include<algorithm> using namespace std; int n; int a[10001]; int main() { freopen("box.in","r",stdin); freopen("box.out","w",stdout); scanf("%d",&n); for(int i=1;i<=n;i++) { scanf("%d",&a[i]); } int ta=1,tot=0; int max=0; sort(a+1,a+n+1); for(int i=n;i>0;i--) { if(max==0) { tot++; max=a[i]; } else { max--; if(a[i]<max) { max=a[i]; } } } cout<<tot<<endl; return 0; fclose(stdin); fclose(stdout); } ```
by 世代空明 @ 2017-07-28 10:33:31


@[世代空明](/space/show?uid=47001) 提交不能有文件读写
by Aehnuwx @ 2017-07-28 10:38:14


@[Xray](/space/show?uid=46747) 这是我们夏令营用的,要用lemon
by 世代空明 @ 2017-07-28 20:16:30


@[世代空明](/space/show?uid=47001) 好吧
by Aehnuwx @ 2017-07-28 21:42:37


|