76012024-01-10 00:54:06rennAutókódoláscpp17Forditási hiba
#include <bits/stdc++.h>
#define ll long long

using namespace std;

ll N, kovval = 0, elozoval = 0, i;
bool elozo[41], kov[41], nincs_elozo;

int main() {

    cin >> N;

    for(ll i = 0; i < 41; i++) {
        kov[40-i] = elozo[40-i] = N & (1LL << i);
    }

    nincs_elozo = prev_permutation(elozo, elozo + 41);
    next_permutation(kov, kov + 41);

    for(i = 40*nincs_elozo; i >= 0; --i) {
        elozoval ^= (elozo[i] << (40-i));
    }

    for(i = 40; i >= 0; --i) {
        kovval ^= (kov[i] << (40-i));
    }

    cout << (nincs_elozo ? "-1" : elozoval) << "\n" << kovval << "\n";
}
Forditási hiba
exit status 1
main.cpp: In function 'int main()':
main.cpp:28:26: error: operands to '?:' have different types 'const char*' and 'long long int'
   28 |     cout << (nincs_elozo ? "-1" : elozoval) << "\n" << kovval << "\n";
      |              ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
Exited with error status 1