摘要:
题目描述:两个数a和b(a 2 #include 3 #include 4 using namespace std; 5 6 const int N = 1001; 7 const int M = 500001; 8 const int E = 100000; 9 bool p... 阅读全文
摘要:
两道题基本一样。判断两个数是否互质即可。设x为走的步数,m为间距,则需要判断 x * m % n 是否可以充满0到n - 1的闭区间。互质的话,存在逆元,所以一定可以。hdu 1222: 1 #include 2 using namespace std; 3 4 int gcd( int a, ... 阅读全文
摘要:
骑士巡游找最短路。单向bfs: 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int N = 8; 7 const int M = N * N; 8 int step[N][N]; 9 int dir[N]... 阅读全文