标签:style blog color io for ar 2014 div
/******************************************************************** @file Main_practise.cpp @date 2014-8-21 @author Tiger @brief Problem E: Jolly Jumpers ********************************************************************/ #include <cstdio> #include <cstring> #define SIZE 3000+1 //#define OJ bool FLag[SIZE]; int Arr[SIZE]; int main(int argc, const char* argv[]) { #ifdef OJ freopen("input.txt", "r", stdin); #endif int nCnt = 0; while (scanf("%d", &nCnt) != EOF) { for (int i=0; i<nCnt; ++i) { scanf("%d", &Arr[i]); } bool bResult = true; int nResult = 0; memset(FLag, false, SIZE); for (int i=0; i<nCnt-1; ++i) { nResult = Arr[i+1] - Arr[i]; nResult = nResult > 0 ? nResult : -nResult; if (nResult > nCnt-1 || 0 == nResult || true == FLag[nResult]) { bResult = false; break; } else { FLag[nResult] = true; } } for (int i=1; i<nCnt-1; ++i) { if (false == FLag[i]) { bResult = false; break; } } if (bResult) { printf("Jolly\n"); } else { printf("Not jolly\n"); } } return 0; }
标签:style blog color io for ar 2014 div
原文地址:http://www.cnblogs.com/roronoa-zoro-zrh/p/3926390.html