結果
問題 | No.156 キャンディー・ボックス |
ユーザー |
|
提出日時 | 2016-10-30 12:13:11 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 152 bytes |
コンパイル時間 | 1,625 ms |
コンパイル使用メモリ | 169,084 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-05 15:56:22 |
合計ジャッジ時間 | 2,543 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
コンパイルメッセージ
main.cpp:2:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type] 2 | main(){int n,m,i;std::cin>>n>>m;int a[n];for(i=n;i;)std::cin>>a[--i];std::sort(a,a+n);while(m>0)m-=a[i++];printf("%d",m?i-1:i);} | ^~~~
ソースコード
#include<bits/stdc++.h> main(){int n,m,i;std::cin>>n>>m;int a[n];for(i=n;i;)std::cin>>a[--i];std::sort(a,a+n);while(m>0)m-=a[i++];printf("%d",m?i-1:i);}