7605 | 2024-01-10 08:37:08 | gkata | Sorozat generálás | cpp17 | Forditási hiba |
// sorozat generalas.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <queue>
#include<map>
#include<math.h>
#define ll long long
using namespace std;
vector<ll>x;
map<ll, ll>sz;
ll m, szam, a, b, l, k, t, i, ans;
bool ok = false;
int main()
{
cin >> m >> szam >> a >> b >> l >> k;
for(i=1;i<=l;++i)
{
szam = szam * a + b;
t = pow(10, 3 * m );
szam = szam % t;
szam /= pow(10, m);
x.push_back(szam);
if (!ok)
{
if (!sz.count(szam)) sz[szam] = i;
else
{
ans = i - sz[szam];
ok = true;
}
}
}
sort(x.begin(), x.end());
cout << ans << "\n" << x[l - k];
}
/*
1 73 11 50 20 10
*/
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu
// Tips for Getting Started:
// 1. Use the Solution Explorer window to add/manage files
// 2. Use the Team Explorer window to connect to source control
// 3. Use the Output window to see build output and other messages
// 4. Use the Error List window to view errors
// 5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
// 6. In the future, to open this project again, go to File > Open > Project and select the .sln file
exit status 1
main.cpp: In function 'int main()':
main.cpp:40:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
40 | sort(x.begin(), x.end());
| ^~~~
| sqrt
Exited with error status 1