結果
| 問題 |
No.617 Nafmo、買い出しに行く
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-01-28 03:00:45 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 249 bytes |
| コンパイル時間 | 836 ms |
| コンパイル使用メモリ | 64,336 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-29 07:34:29 |
| 合計ジャッジ時間 | 2,654 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | AC * 5 WA * 15 |
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main()
| ^~~~
ソースコード
#include<iostream>
using namespace std;
int n,k,a[33];
main()
{
cin>>n>>k;for(int i=0;i<n;i++)cin>>a[i];
int ans=0;
for(int i=0;i<1<<n;i++)
{
int now=0;
for(int j=0;j<n;j++)i&(1<<j)&&(now+=a[j]);
ans=ans<now?now:ans;
}
cout<<ans<<endl;
}