150532025-02-11 18:49:22zhuyiTáblajáték 2 (70 pont)cpp17Hibás válasz 28/701ms508 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
void harmasba(int num)
{   if(num == 0){
    return;
    }
    int x = num % 3;
    num /= 3;
    harmasba(num);

    cout << x;
}
int main()
{
    int n; cin >> n;
    vector <int> S(n);
    for(int i = 0; i < n; i++) cin >> S[i];
    ll ans = 0, num = 0;
    for(int i = 0; i < n; i++){
        if(S[i] >= 0 && S[i] <= 2){
            ans++;
            num = num*3 + S[i];
        }
        else if(S[i] == 3){
            ans--;
            num /= 3;
        }
        else if(S[i] == 4){
            num--;
        }
        else num++;
    }
    cout << ans << "\n";
    harmasba(num);
    return 0;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base28/70
1Elfogadva0/01ms316 KiB
2Hibás válasz0/01ms316 KiB
3Elfogadva2/21ms316 KiB
4Részben helyes1/31ms316 KiB
5Elfogadva3/31ms316 KiB
6Részben helyes1/31ms316 KiB
7Elfogadva3/31ms316 KiB
8Részben helyes1/31ms316 KiB
9Részben helyes1/31ms316 KiB
10Részben helyes1/31ms320 KiB
11Elfogadva3/31ms316 KiB
12Részben helyes1/31ms316 KiB
13Részben helyes1/31ms500 KiB
14Részben helyes1/31ms316 KiB
15Részben helyes1/41ms316 KiB
16Részben helyes1/41ms508 KiB
17Részben helyes1/41ms316 KiB
18Részben helyes1/41ms348 KiB
19Részben helyes1/41ms316 KiB
20Részben helyes1/41ms316 KiB
21Részben helyes1/41ms316 KiB
22Részben helyes1/41ms316 KiB
23Részben helyes1/31ms316 KiB