ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1431. Diplomas

why wa
Posted by ................. 25 Feb 2006 13:29
#include <iostream>
#include <algorithm>

using namespace std;

int n;
int a[30];

int main()
{
    cin >> n;
    int i;
    for (i=0;i<n;i++)
        cin >> a[i];
    sort(a,a+n);
    int ans=n;
    for (i=0;i<n-1;i++)
        if (a[i+1]-a[i]==1)
        {
            i++;
            ans--;
        }
    cout << ans << endl;
    cin >> n;
}
Re: why wa
Posted by Squid 25 Feb 2006 15:07
try this test:
4
1 1 2 2
correct answer is 2
Re: why wa
Posted by [AESC USU] Golubev_Sanja 25 Feb 2006 15:37
I have the same answer, but i still have WA 6. Could you give some more tests?
Re: why wa
Posted by Trident 25 Feb 2006 16:38
You considered the problem to be too simple...
Re: why wa
Posted by Seishau Dongi 25 Feb 2006 17:56
What do you mean?
Re: why wa
Posted by Мадест 1 Mar 2006 17:21
Try this test:
5
5 7 6 7 4

Answer is 3
Re: why wa
Posted by Nec_32 2 Aug 2008 02:17
Мадест wrote 1 March 2006 17:21
Try this test:
5
5 7 6 7 4

Answer is 3

Why answer is 3 ???????????
Re: why wa
Posted by Nec_32 2 Aug 2008 12:16
все понял
a=5
b=7
c=6
d=7
e=4
-------------
______|
__aeaeaeaea
bcbcbcbcbcbcb
___ddddddd


Accepted    0.001    141 КБ )))

Edited by author 02.08.2008 12:17