QList<int> ValueModelBase::getCompositeNumber(QList<int> in)
{
	QList<int> prime = getPrimeNumber(in);
	QList<int> composite = in;
	for (auto& obj: composite)
	{
		if (prime.contains(obj))
		{
			composite.removeOne(obj);
			
		}
	}

	return composite;
}
Example #2
0
int ZGS::getValue(Lotter inLotter) const
{
	return getPrimeNumber(inLotter.redBall).size();
}
Example #3
0
int main(void)
{
	int T;
	char dataChar[10] = { 0, };
	int number[10] = { 0, };
	int ans;

	getPrimeNumber();

	scanf("%d", &T);

	for (int test_case = 1; test_case <= T; ++test_case){
		ans = 0;
		scanf("%s", dataChar);
		int cnt = 0;
		int i = 0;
		while (dataChar[i] != 0){
			number[cnt++] = dataChar[i] - '0';
			i++;
		}

		int seed;
		int x_cnt, y_cnt, z_cnt;

		for (int i = 0; i < cnt; ++i){
			seed = number[i];
			//without see, make it new array
			int newArray[10] = { 0, };
			int idx = 0;

			for (int k = 0; k < cnt; ++k){
				if (i == k)continue;
				newArray[idx] = number[k];
				idx++;
			}


			for (int x = 1; x < cnt - 3; ++x){
				for (int y = 1; y < cnt - 3; ++y){
					for (int z = 1; z < cnt - 1; ++z){
						x_cnt = x;
						y_cnt = y;
						z_cnt = z;
						if (1 == cnt - (x_cnt + y_cnt + z_cnt)){
							int p1 = 0;
							int p2 = 0;
							int p3 = 0;
							

							if (newArray[0] == 0 || newArray[x_cnt] == 0 || newArray[x_cnt + y_cnt] == 0)continue;

							int tempCnt = cnt - 1;
							int idx = 0;
							while (tempCnt != 0){
								if (x_cnt > 0){
									if (1 == x_cnt) p1 += newArray[idx++];
									else p1 += (newArray[idx++] * sqrt_custom(10, x_cnt - 1));
	
									x_cnt--;
								}
								else if (y_cnt > 0){
									if (1 == y_cnt) p2 += newArray[idx++];
									else p2 += (newArray[idx++] * sqrt_custom(10, y_cnt - 1));
									
									y_cnt--;
								}
								else if (z_cnt > 0){
									if (1 == z_cnt) p3 += newArray[idx++];
									else p3 += (newArray[idx++] * sqrt_custom(10, z_cnt - 1));
									
									z_cnt--;
								}
								tempCnt--;
							}

							if (data[p1] && data[p2] && data[p3]){
								int max = 0;
								if (p1 > max) max = p1;
								if (p2 > max) max = p2;
								if (p3 > max) max = p3;

								int min = 99999999;
								if (p1 < min) min = p1;
								if (p2 < min) min = p2;
								if (p3 < min) min = p3;

								if (seed == ((max - min) % 10)){
									ans = 1;
								}
							}

						}
					}
				}
			}
		}
		printf("%d\n", ans);
	}

	return 0;
}