|
|
вернуться в форумwhy wa #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 Послано Squid 25 фев 2006 15:07 try this test: 4 1 1 2 2 correct answer is 2 Re: why wa I have the same answer, but i still have WA 6. Could you give some more tests? Re: why wa You considered the problem to be too simple... Re: why wa What do you mean? Re: why wa Послано Мадест 1 мар 2006 17:21 Try this test: 5 5 7 6 7 4 Answer is 3 Re: why wa Послано Nec_32 2 авг 2008 02:17 Try this test: 5 5 7 6 7 4 Answer is 3 Why answer is 3 ??????????? Re: why wa Послано Nec_32 2 авг 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 |
|
|