Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <algorithm>
- using namespace std;
- ifstream fin("cifre.in");
- ofstream fout("cifre.out");
- int aprinse[10] = {6, 2, 5, 5, 4, 5, 6, 3, 7, 6};
- int v[10] = {1, 5, 1, 2, 2, 3, 1, 2, 0, 0};
- int main()
- {
- int cerinta, nr;
- fin >> cerinta >> nr;
- if(cerinta == 1)
- {
- int cnr = nr, apr = 0;
- while(cnr)
- {
- apr += aprinse[cnr % 10];
- cnr /= 10;
- }
- fout << apr;
- }
- else if(cerinta == 2)
- {
- int nrmari = 0, produs = 1;
- while(nr)
- {
- nrmari += v[nr % 10];
- produs *= nrmari;
- nr /= 10;
- }
- nrmari += produs;
- fout << nrmari;
- }
- fin.close();
- fout.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement