题意:
https://atcoder.jp/contests/arc117/tasks/arc117_c
思路:
妙
https://atcoder.jp/contests/arc117/editorial/1136
void sol() {
init();
int n, ans = 0; cin >> n;
for(int i = 1; i <= n; i++) {
char c; cin >> c; // n > p, 得用lucas
(ans += lucas(n - 1, n - i) * (c == 'B' ? 0 : (c == 'W' ? 1 : 2))) %= 3;
}
ans %= 3;
ans = ((n & 1 ? 1 : -1) * ans + 3) % 3;
cout << (ans == 0 ? 'B' : (ans == 1 ? 'W' : 'R'));
}
标签:atcoder,Pyramid,arc117,int,jp,Tricolor,ans
From: https://www.cnblogs.com/wushansinger/p/17073929.html