百练OJ-Prime Path

#include
#include
#include
#include
#include
using namespace std;

vectorprimes;

void makeprimes() {
	primes.push_back(2);
	for (int i = 3; i < 100; i += 2) {
		bool fg = true;
		for (int j = 0; jq;
	int cost[10000];
	memset(cost, -1, sizeof(cost));

	q.push(a);
	cost[a] = 0;
	while (!q.empty()) {
		int now = q.front();
		q.pop();
		int gewei = now % 10;
		int shiwei = int(now / 10)%10;
		int baiwei = int(now / 100) % 10;
		int qianwei = int(now / 1000);

		int costnow = cost[now];

		if (now == b) {
			cout<> n;
	makeprimes();

	while (n--) {
		cin >> a >> b;
		BFS(a, b);
	}
    return 0;
}

你可能感兴趣的:(百练OJ-Prime Path)