7324 | 2024-01-07 11:50:42 | Laci3000 | Zenehallgatás | cpp17 | Compilation error |
// 2021 nt masodik.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
void oszthato_e_31el() {
long long bemeneti_szam; cin >> bemeneti_szam;
vector<long long>lepesek;
if (bemeneti_szam % 31 == 0) {
cout << "IGEN" << '\n';
}
else {
cout << "NEM" << '\n';
}
while (bemeneti_szam > 30){
string szam = to_string(bemeneti_szam);
// cerr << bemeneti_szam - (szam[szam.size() - 1] - '0') << '\n';
bemeneti_szam = (bemeneti_szam - (szam[szam.size() - 1] - '0')) / 10 - 3 * (szam[szam.size() - 1] - '0');
//cerr << bemeneti_szam << '\n';
if (bemeneti_szam >= 0) {
lepesek.push_back(bemeneti_szam);
}
}
for (size_t i = 0; i < lepesek.size(); i++)
{
cout << lepesek[i] << " ";
}
}
void hatekony_tori() {
unordered_map<int, bool>szamok;
int mennyiseg; cin >> mennyiseg;
vector<int>listS(mennyiseg);
int kulonbozoek = 1;
for (int i = 0; i < mennyiseg; i++) {
cin >> listS[i];
}
int utolso_uj_szam = mennyiseg - 1;
szamok[listS[utolso_uj_szam]] = true;
for(int i = mennyiseg - 1; i >= 0; i--){
if (!szamok[listS[i]]) {
utolso_uj_szam = i;
szamok[listS[i]] = true;
kulonbozoek++;
}
}
cout << utolso_uj_szam + 1;
}
void melyik_zene_szol() {
int zenek, idopontok; cin >> zenek >> idopontok;
vector<int>zeneS(zenek);
vector<int>idopontS(idopontok), idopont_zene(idopontok);
int szam_osszeg = 0;
for (int i = 0; i < zenek; i++) {
cin >> zeneS[i];
szam_osszeg += zeneS[i];
}
for (int i = 0; i < idopontok; i++) {
cin >> idopontS[i];
idopontS[i] %= szam_osszeg;
if (idopontS[i] == 0) {
idopont_zene[i] = zenek;
}
else {
int a = 0;
while (idopontS[i] > 0) {
idopontS[i] -= zeneS[a];
a++;
}
cout << a << " ";
}
}
}
int main()
{
cin.tie(false);
ios::sync_with_stdio(false);
melyik_zene_szol();
}
exit status 1
main.cpp: In function 'int main()':
main.cpp:94:12: error: no matching function for call to 'std::basic_istream<char>::tie(bool)'
94 | cin.tie(false);
| ~~~~~~~^~~~~~~
In file included from /usr/include/c++/11/ios:44,
from /usr/include/c++/11/ostream:38,
from /usr/include/c++/11/iostream:39,
from main.cpp:4:
/usr/include/c++/11/bits/basic_ios.h:295:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie() const [with _CharT = char; _Traits = std::char_traits<char>]'
295 | tie() const
| ^~~
/usr/include/c++/11/bits/basic_ios.h:295:7: note: candidate expects 0 arguments, 1 provided
/usr/include/c++/11/bits/basic_ios.h:307:7: note: candidate: 'std::basic_ostream<_CharT, _Traits>* std::basic_ios<_CharT, _Traits>::tie(std::basic_ostream<_CharT, _Traits>*) [with _CharT = char; _Traits = std::char_traits<char>]'
307 | tie(basic_ostream<_CharT, _Traits>* __tiestr)
| ^~~...