Example #1
0
        public void Solve()
        {
            Func <int, int, wb[]> paintColor = null;

            paintColor = (from, now) =>
            {
                var ret = new wb[2] {
                    1, 1
                };
                foreach (var to in abList[now])
                {
                    // ?????? ???????????
                    if (from == to)
                    {
                        continue;
                    }
                    var res = paintColor(now, to);
                    // ???+?
                    ret[0] *= res[0] + res[1];
                    // ???
                    ret[1] *= res[0];
                }
                return(ret);
            };
            var ans = paintColor(-1, 0);

            Console.WriteLine((ans[0] + ans[1]).num);
        }
Example #2
0
        wb[] paintColor(int from, int now)
        {
            var ret = new wb[2] {
                1, 1
            };

            foreach (var to in abList[now])
            {
                // ?????? ???????????
                if (from == to)
                {
                    continue;
                }
                var res = paintColor(now, to);
                // ???+?
                ret[0] *= res[0] + res[1];
                // ???
                ret[1] *= res[0];
            }
            return(ret);
        }
Example #3
0
 => FuncParse = () => ExtendFromWorkbook(wb, excludedSheetNames);