Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

数组开到60001就过了。水的一比那啥,害我贡献两次wa。还有代码比我更少更好理解的?

Posted by 1989wd3 at 2012-11-20 13:27:10 on Problem 3183
#include<iostream>
using namespace std;


int main()
{
    int n;
    int a[60001];
    cin >> n;
    a[0] = a[n+1] = 0;
    for(int i = 1; i <= n; i++)
        cin >> a[i];
    for(int i = 1; i <= n; i++)
    {   
        if(a[i] >= a[i-1] && a[i] >= a[i+1])
            cout << i << endl;
    }   
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator