[ACM ] 11059 WA
第一次寫沒看到連續 寫完還跑回去改囧
http://nopaste.info/d4fdb62795.html
測資都對了,自己也假設了一些測資丟進去也對..
請版友們幫幫忙 謝謝
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int num,data,max=1,round=0;
vector<int> v;
vector<int> Max;
while(cin>>num)
{
round++;
for(int i=0;i<num;i++)
{
cin>>data;
v.push_back(data);
}
for(unsigned int i=0;i<v.size();i++)
{
for(unsigned int j=0;j<v.size()-i;j++)
{
for(unsigned int k=i;k<v.size()-j;k++)
{
max=max*v[k]; //brute force
}
Max.push_back(max);
max=1;
}
}
sort(Max.begin(),Max.end());
if(Max[Max.size()-1]<0 )
{
Max[Max.size()-1]=0;
}
cout<<"Case #"<<round<<": The maximum product is
"<<Max[Max.size()-1]<<'.'<<endl<<endl;
v.clear();
Max.clear();
}
return 0;
}
--
~宅男的四個徵兆~
∠□ ○ ! * \○/ ★ (○ ?
╦╦└□ " ○□═ □ □>
║║√√ ╦══╦ ∥ |\
一回家就上PTT 每天想正妹 以當好人為樂 忘記正妹虧欠自己
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.169.98.243
→
09/03 15:54, , 1F
09/03 15:54, 1F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章