[CF]580A - Kefa and First Steps
題目:
http://codeforces.com/problemset/problem/580/A
-------------------------------------------------------------------------------------------
#include<iostream>
#include<cstdio>
using namespace std;
int main(void)
{
int n;
while(scanf("%d",&n)!=EOF)
{
int x = 0,y = 0,mx = 1,cnt = 1;
for(int i=0;i<n;i++)
{
scanf("%d",&x);
if(x>=y && i!=0)
{
cnt++;
}
else
cnt = 1;
if(cnt > mx)
mx = cnt;
y = x;
}
cout << mx << endl;
}
return 0;
}
http://codeforces.com/problemset/problem/580/A
-------------------------------------------------------------------------------------------
#include<iostream>
#include<cstdio>
using namespace std;
int main(void)
{
int n;
while(scanf("%d",&n)!=EOF)
{
int x = 0,y = 0,mx = 1,cnt = 1;
for(int i=0;i<n;i++)
{
scanf("%d",&x);
if(x>=y && i!=0)
{
cnt++;
}
else
cnt = 1;
if(cnt > mx)
mx = cnt;
y = x;
}
cout << mx << endl;
}
return 0;
}
留言
張貼留言