错4 7 8 9四个点 求指出错误

P1567 统计天数

```cpp 插代码谢谢 ```
by JAMERES86 @ 2018-08-13 08:06:52


#include<iostream> #include<string> #include <memory.h> #include <vector> #include <sstream> #include <algorithm> #include <math.h> #include<iomanip> using namespace std; bool abc(long long a,long long b) { return a>b; } int main() { long long n; int to=0; long long x[100000]={0}; int s=0; cin>>n; if(n==1) { cout<<"0"; return 0; } long long* ps =new long long [n]; for(int i=0;i<n;i++) { cin>>ps[i]; } for(int i=0;i<n-1;i++) { if(ps[i]<ps[i+1]) { to++; x[s]=to+1; } else { to=0; s++; } } sort(x,x+100000,abc); cout<<x[0]; return 0; } ```@[JAMERES86](/space/show?uid=95875)
by 广西蒟蒻Hz @ 2018-08-13 08:24:07


这么乱谁看啊
by 子寒 @ 2018-08-13 08:24:26


@[JAMERES86](/space/show?uid=95875) how to do it
by 广西蒟蒻Hz @ 2018-08-13 08:25:03


@[子寒](/space/show?uid=121391) 怎么插入 不是很懂
by 广西蒟蒻Hz @ 2018-08-13 08:25:37


``` #include<iostream> #include<string> #include <memory.h> #include <vector> #include <sstream> #include <algorithm> #include <math.h> #include<iomanip> using namespace std; bool abc(long long a,long long b) { return a>b; } int main() { long long n; int to=0; long long x[100000]={0}; int s=0; cin>>n; if(n==1) { cout<<"0"; return 0; } long long* ps =new long long [n]; for(int i=0;i<n;i++) { cin>>ps[i]; } for(int i=0;i<n-1;i++) { if(ps[i]<ps[i+1]) { to++; x[s]=to+1; } else { to=0; s++; } } sort(x,x+100000,abc); cout<<x[0]; return 0; } ```
by 广西蒟蒻Hz @ 2018-08-13 08:27:32


new完都不delete的吗
by a___ @ 2018-08-13 09:03:59


```cpp //PS:你的源代码多了很多不需要的东西 #include<iostream> using namespace std; int ps[10000000]; int n,to,ans; int main() { cin>>n; if(n==1) { cout<<"1"; return 0; } for(int i=1;i<=n;i++) { cin>>ps[i]; } for(int i=1;i<=n;i++) { if(ps[i]>ps[i-1]) { // cout<<ps[i]<<endl; to++; ans=max(ans,to); } else { to=1; // cout<<"------- NEW START at "<<ps[i]<<" -------"<<endl; } } cout<<ans<<endl; return 0; } ```
by JAMERES86 @ 2018-08-13 09:19:30


@[JAMERES86](/space/show?uid=95875) 谢了!
by 广西蒟蒻Hz @ 2018-08-13 09:54:09


@[LxisHz小弟弟](/space/show?uid=56238) 卡了时间吧,两次循环规模为10e7,你可能需要改进一下算法
by 子寒 @ 2018-08-13 10:01:15


| 下一页