208142026-01-09 12:30:48tenyeszbikaSorozat generáláscpp17Wrong answer 18/5020ms1060 KiB
#include <iostream>
#include <vector>
#include <deque>
#include <algorithm>
#include <climits>

using namespace std;

int m,n,tav,szami,r,a,b,x,k,j;

vector<int> v;
vector<int>::iterator p1;
vector<int>::iterator p2;

int szam()
{
	deque<int> s;
	szami = r * a + b;
	while (szami > 0)
	{
		s.push_front(szami % 10);
		szami = szami / 10;
	}
	while(s.size()<m*4)
	{
		s.push_front(0);
	}
	r = 0;
	for (int i = m; i <= m * 3 - 1; ++i)
	{
		r = r * 10 + s[i];
	}
	return r;
}

int main()
{
	cin >> m >> x >> a >> b >> n >> k;
	for (int i = 1; i <= n; ++i)
	{
		if (r == 0) r = x;
		v.push_back(szam());
	}
	for (int i = 0; i <= n - 1; ++i)
	{
		p1 = find(v.begin(), v.end(), v[i]);
		if (find(p1 + 1, v.end(), v[i]) != v.end())
		{
			
			p2 = find(p1 + 1, v.end(), v[i]);
			break;
		}
	}
	cout << distance(p1, p2) << endl;
	sort(v.rbegin(), v.rend());
	cout << v[k - 1];
}
SubtaskSumTestVerdictTimeMemory
base18/50
1Accepted0/01ms316 KiB
2Wrong answer0/017ms944 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/22ms316 KiB
5Accepted2/22ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/22ms316 KiB
8Accepted4/43ms316 KiB
9Wrong answer0/44ms468 KiB
10Accepted4/420ms736 KiB
11Accepted4/416ms780 KiB
12Wrong answer0/412ms1016 KiB
13Wrong answer0/417ms1040 KiB
14Wrong answer0/417ms944 KiB
15Wrong answer0/417ms1040 KiB
16Wrong answer0/418ms1060 KiB
17Wrong answer0/417ms944 KiB