Topic Portal
1 /*2 Test instructions: N digital turntable, starting with each turntable pointing to a number (0~n-1, counter-clockwise sort), and then every turn, odd +1, even 1, ask how many times to make the first I digital turntable point to i-13 Construction: The first to ask the 1th point to 0 how many steps, according to the number of times after the ability to meet the requirements4 the topic reads well tired: (5 */6#include <cstdio>7#include <iostream>8#include <algorithm>9#include <cstring>Ten#include <cmath> One using namespacestd; A - Const intMAXN = 1e3 +Ten; - Const intINF =0x3f3f3f3f; the intA[MAXN]; - - intMainvoid)//codeforces Round #310 (Div. 2) b. Case of Fake Numbers - { + //freopen ("b.in", "R", stdin); - + intN; A while(SCANF ("%d", &n) = =1) at { - for(intI=1; i<=n; ++i) scanf ("%d", &a[i]); - intCNT =0; - if(a[1] !=0) - { -CNT = (N-1)-a[1] +1; in } - to BOOLFlag =true; + for(intI=2; i<=n; ++i) - { the if(I &1) * { $ for(intj=1; j<=cnt; ++j)Panax Notoginseng { -a[i]++; the if(A[i] = = N) a[i] =0; + } A if(A[i]! = i-1) {flag =false; Break;} the } + Else - { $ for(intj=1; j<=cnt; ++j) $ { -a[i]--; - if(A[i] = =-1) A[i] = n-1; the } - if(A[i]! = i-1) {flag =false; Break;}Wuyi } the } - Wu(flag)? Puts ("Yes"): Puts ("No"); - } About $ return 0; -}
Constructs Codeforces Round #310 (Div. 2) b. Case of Fake Numbers