题意

原题地址:Codeforces

一句话题意:有三种颜色的点,现在要在这些点之间连边权为1的边,同种颜色的点之间的距离要不少于3,求合法的方案数。

阅读全文

题目描述

原题地址:Codeforces

一句话题意,有一颗树,对这颗树进行dfs,求dfs路径长度的期望值

阅读全文

题目描述

原题地址:Codeforces

思路

固定两个相邻的点,其中一个是顶点,然后枚举另一个点的位置,求角。

观察到所成角每次增加$\frac{\pi}{n}$,然后就递推一波。。

阅读全文

A题

题目描述

原题地址:Codeforces

题意:判断回文时间。

解决方案

先搞出来一个判断回文的函数,然后枚举分钟。

阅读全文

题目描述

问题:题目地址中文版

思路

注意到$a,b\leq 60$,所以预处理出所有$x^a,y^b$存起来,然后两两求和,去重, 然后处理一下得到答案。

坑点

  1. 开unsigned long long

  2. while (num <= 1e18)
       num = num * x
    

    这样写是不符合基本法的,会溢出掉的

阅读全文

题目描述

问题:题目地址

Vladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:

Vladik is at initial train station, and now n people (including Vladik) want to get on the train. They are already lined up in some order, and for each of them the city code $a_i$ is known (the code of the city in which they are going to).

阅读全文