9218 2024. 02. 18 18:47:20 Kristóf Táblajáték 2 (70 pont) cpp14 Hibás válasz 28/70 3ms 4272 KiB
#include <iostream>
#include <vector>
#include <bits/stdc++.h>


using namespace std;
struct poz{

int sor;
int hely;

}typedef poz;

int main()
{
    poz tabla;
    tabla.sor=0;
    tabla.hely=0;
    int n;
    int num;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>num;
        if(num==0){
            tabla.sor++;
            tabla.hely=tabla.hely*3;
        }
        else if(num==1){
            tabla.sor++;
            tabla.hely=tabla.hely*3+1;
        }
        else if(num==2){
            tabla.sor++;
            tabla.hely=tabla.hely*3+2;
        }
        else if(num==3){
            tabla.sor--;
            tabla.hely=tabla.hely/3;
        }
        else if(num==4){
            tabla.hely--;
        }
        else{
            tabla.hely++;
        }

    }
    vector <int> harmasr;
    cout<<tabla.sor<<endl;
    int m=0;
    while (tabla.hely!=0){
        harmasr.push_back(tabla.hely%3);
        tabla.hely=tabla.hely/3;

        m++;


    }
    for(int i=harmasr.size()-1;i>-1;i--){
        cout<<harmasr[i];
    }


    return 0;
}
Részfeladat Összpont Teszt Verdikt Idő Memória
base 28/70
1 Elfogadva 0/0 3ms 1960 KiB
2 Hibás válasz 0/0 3ms 2012 KiB
3 Elfogadva 2/2 3ms 2224 KiB
4 Részben helyes 1/3 3ms 2436 KiB
5 Elfogadva 3/3 3ms 2652 KiB
6 Részben helyes 1/3 3ms 2732 KiB
7 Elfogadva 3/3 3ms 2864 KiB
8 Részben helyes 1/3 3ms 3072 KiB
9 Részben helyes 1/3 3ms 3284 KiB
10 Részben helyes 1/3 3ms 3496 KiB
11 Elfogadva 3/3 3ms 3740 KiB
12 Részben helyes 1/3 3ms 3824 KiB
13 Részben helyes 1/3 3ms 3824 KiB
14 Részben helyes 1/3 3ms 3940 KiB
15 Részben helyes 1/4 3ms 3908 KiB
16 Részben helyes 1/4 3ms 3792 KiB
17 Részben helyes 1/4 3ms 3792 KiB
18 Részben helyes 1/4 3ms 3796 KiB
19 Részben helyes 1/4 3ms 3924 KiB
20 Részben helyes 1/4 3ms 4124 KiB
21 Részben helyes 1/4 3ms 4240 KiB
22 Részben helyes 1/4 3ms 4272 KiB
23 Részben helyes 1/3 3ms 4252 KiB