| ||||||||||
Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
大家帮我看看,为什么总是WA?帮我改改#include<iostream> using namespace std; int main() { int n, m, i, j, t; int c = 0; int *a, *b; while(1) { cin >> n; b = new int[n]; for(i=0; i<n; i++) { cin >> m; if(m<0) m = -m; b[i] = m; } if(n==1) { cout << "Not jolly" << endl; return 0; } t = n - 1; a = new int[t]; for(i=1; i<=t; i++) a[i] = i; for(i=0; i<n; i++) { if(b[i]==0||b[i]>=n) c++; else { for(j=1; j<=t; j++) { if(b[i]==a[j]) { a[j] = 0; break; } } if(j>t) c++; } if(c>1) { cout << "Not jolly" << endl; break; } } if(i==n) cout << "Jolly" << endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator