Detalii evaluare #16411717

Rezumat problemă

#970 Gen

Pe planeta Marte, marţienii folosesc în calculele aritmetice doar cifrele 0, 1, 2 şi 3. Ei au inventat un nou sistem binar de numeraţie. Pornind de la numărul 23, ei generează numere binare speciale aplicând de un număr finit de ori regulile din tabelul de mai jos:

  1. Cifra 2 se poate înlocui cu succesiunea: 12
  2. Cifra 3 se poate înlocui cu succesiunea: 03
  3. Cifra 2 se poate înlocui cu succesiunea: 01
  4. Cifra 3 se poate înlocui cu succesiunea: 10

Marţienii au început să genereze un astfel de număr, aplicând succesiv (în această ordine): de n ori regula 1); de k ori regula 2); o singură dată regula 3) şi o singură dată regula 4). Nefiind atenţi, ei nu au reuşit să ducă la capăt generarea şi au nevoie de ajutor. Ajutaţi-i să genereze numărul binar dorit.

Scrieţi un program care citeşte numerele naturale nenule n şi k şi care afişează numărul binar obţinut în urma aplicării succesive a regulilor cerute de marţieni.

Olimpiada de Informatică, etapa pe sector, Bucureşti, 2007, clasa a VI-a

Detalii

Problema Gen Operații I/O tastatură/ecran
Limita timp 1 secunde Limita memorie Total: 2 MB / Stivă 1 MB
Id soluție #16411717 Utilizator Stroescu Stefan (stefan00)
Fișier gen.cpp Dimensiune 309 B
Data încărcării 30 Iulie 2019, 02:06 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

gen.cpp:1:9: error: #include expects "FILENAME" or <FILENAME>
 #include <bits/stdc++.h>

         ^
gen.cpp:2:1: error: stray '\302' in program
 using namespace std;

 ^
gen.cpp:2:1: error: stray '\240' in program
gen.cpp:2:1: error: stray '\302' in program
gen.cpp:2:1: error: stray '\240' in program
gen.cpp:3:1: error: stray '\302' in program
 int n, k, i, j;

 ^
gen.cpp:3:1: error: stray '\240' in program
gen.cpp:3:1: error: stray '\302' in program
gen.cpp:3:1: error: stray '\240' in program
gen.cpp:3:1: error: stray '\302' in program
gen.cpp:3:1: error: stray '\240' in program
gen.cpp:3:1: error: stray '\302' in program
gen.cpp:3:1: error: stray '\240' in program
gen.cpp:4:1: error: stray '\302' in program
 int main()

 ^
gen.cpp:4:1: error: stray '\240' in program
gen.cpp:6:1: error: stray '\302' in program
    cin >> n >> k;

 ^
gen.cpp:6:1: error: stray '\240' in program
gen.cpp:6:1: error: stray '\302' in program
gen.cpp:6:1: error: stray '\240' in program
gen.cpp:6:1: error: stray '\302' in program
gen.cpp:6:1: error: stray '\240' in program
gen.cpp:6:1: error: stray '\302' in program
gen.cpp:6:1: error: stray '\240' in program
gen.cpp:6:1: error: stray '\302' in program
gen.cpp:6:1: error: stray '\240' in program
gen.cpp:6:1: error: stray '\302' in program
gen.cpp:6:1: error: stray '\240' in program
gen.cpp:6:1: error: stray '\302' in program
gen.cpp:6:1: error: stray '\240' in program
gen.cpp:7:1: error: stray '\302' in program
    for(i = 1; i <= n; i ++)

 ^
gen.cpp:7:1: error: stray '\240' in program
gen.cpp:7:1: error: stray '\302' in program
gen.cpp:7:1: error: stray '\240' in program
gen.cpp:7:1: error: stray '\302' in program
gen.cpp:7:1: error: stray '\240' in program
gen.cpp:7:1: error: stray '\302' in program
gen.cpp:7:1: error: stray '\240' in program
gen.cpp:7:1: error: stray '\302' in program
gen.cpp:7:1: error: stray '\240' in program
gen.cpp:7:1: error: stray '\302' in program
gen.cpp:7:1: error: stray '\240' in program
gen.cpp:7:1: error: stray '\302' in program
gen.cpp:7:1: error: stray '\240' in program
gen.cpp:7:1: error: stray '\302' in program
gen.cpp:7:1: error: stray '\240' in program
gen.cpp:7:1: error: stray '\302' in program
gen.cpp:7:1: error: stray '\240' in program
gen.cpp:7:1: error: stray '\302' in program
gen.cpp:7:1: error: stray '\240' in program
gen.cpp:8:1: error: stray '\302' in program
     cout << 1;

 ^
gen.cpp:8:1: error: stray '\240' in program
gen.cpp:8:1: error: stray '\302' in program
gen.cpp:8:1: error: stray '\240' in program
gen.cpp:8:1: error: stray '\302' in program
gen.cpp:8:1: error: stray '\240' in program
gen.cpp:8:1: error: stray '\302' in program
gen.cpp:8:1: error: stray '\240' in program
gen.cpp:8:1: error: stray '\302' in program
gen.cpp:8:1: error: stray '\240' in program
gen.cpp:8:1: error: stray '\302' in program
gen.cpp:8:1: error: stray '\240' in program
gen.cpp:9:1: error: stray '\302' in program
    cout << 0 << 1;

 ^
gen.cpp:9:1: error: stray '\240' in program
gen.cpp:9:1: error: stray '\302' in program
gen.cpp:9:1: error: stray '\240' in program
gen.cpp:9:1: error: stray '\302' in program
gen.cpp:9:1: error: stray '\240' in program
gen.cpp:9:1: error: stray '\302' in program
gen.cpp:9:1: error: stray '\240' in program
gen.cpp:9:1: error: stray '\302' in program
gen.cpp:9:1: error: stray '\240' in program
gen.cpp:9:1: error: stray '\302' in program
gen.cpp:9:1: error: stray '\240' in program
gen.cpp:9:1: error: stray '\302' in program
gen.cpp:9:1: error: stray '\240' in program
gen.cpp:10:1: error: stray '\302' in program
    for(j = 1; j <= k; j ++)

 ^
gen.cpp:10:1: error: stray '\240' in program
gen.cpp:10:1: error: stray '\302' in program
gen.cpp:10:1: error: stray '\240' in program
gen.cpp:10:1: error: stray '\302' in program
gen.cpp:10:1: error: stray '\240' in program
gen.cpp:10:1: error: stray '\302' in program
gen.cpp:10:1: error: stray '\240' in program
gen.cpp:10:1: error: stray '\302' in program
gen.cpp:10:1: error: stray '\240' in program
gen.cpp:10:1: error: stray '\302' in program
gen.cpp:10:1: error: stray '\240' in program
gen.cpp:10:1: error: stray '\302' in program
gen.cpp:10:1: error: stray '\240' in program
gen.cpp:10:1: error: stray '\302' in program
gen.cpp:10:1: error: stray '\240' in program
gen.cpp:10:1: error: stray '\302' in program
gen.cpp:10:1: error: stray '\240' in program
gen.cpp:10:1: error: stray '\302' in program
gen.cpp:10:1: error: stray '\240' in program
gen.cpp:11:1: error: stray '\302' in program
     cout << 0;

 ^
gen.cpp:11:1: error: stray '\240' in program
gen.cpp:11:1: error: stray '\302' in program
gen.cpp:11:1: error: stray '\240' in program
gen.cpp:11:1: error: stray '\302' in program
gen.cpp:11:1: error: stray '\240' in program
gen.cpp:11:1: error: stray '\302' in program
gen.cpp:11:1: error: stray '\240' in program
gen.cpp:11:1: error: stray '\302' in program
gen.cpp:11:1: error: stray '\240' in program
gen.cpp:11:1: error: stray '\302' in program
gen.cpp:11:1: error: stray '\240' in program
gen.cpp:12:1: error: stray '\302' in program
    cout << 10;

 ^
gen.cpp:12:1: error: stray '\240' in program
gen.cpp:12:1: error: stray '\302' in program
gen.cpp:12:1: error: stray '\240' in program
gen.cpp:12:1: error: stray '\302' in program
gen.cpp:12:1: error: stray '\240' in program
gen.cpp:12:1: error: stray '\302' in program
gen.cpp:12:1: error: stray '\240' in program
gen.cpp:12:1: error: stray '\302' in program
gen.cpp:12:1: error: stray '\240' in program
gen.cpp:13:1: error: stray '\302' in program
    return 0;

 ^
gen.cpp:13:1: error: stray '\240' in program
gen.cpp:13:1: error: stray '\302' in program
gen.cpp:13:1: error: stray '\240' in program
gen.cpp:13:1: error: stray '\302' in program
gen.cpp:13:1: error: stray '\240' in program
gen.cpp:13:1: error: stray '\302' in program
gen.cpp:13:1: error: stray '\240' in program
gen.cpp: In function 'int main()':
gen.cpp:6:7: error: 'cin' was not declared in this scope
    cin >> n >> k;

       ^
gen.cpp:8:9: error: 'cout' was not declared in this scope
     cout << 1;

         ^
gen.cpp:9:7: error: 'cout' was not declared in this scope
    cout << 0 << 1;

       ^

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema Gen face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.