|
|
back to boardwhy 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 Posted by Squid 25 Feb 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 Posted by Trident 25 Feb 2006 16:38 You considered the problem to be too simple... Re: why wa 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 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 |
|
|