Cod sursa(job #2376556)
Utilizator | Data | 8 martie 2019 16:19:58 | |
---|---|---|---|
Problema | Cautare binara | Scor | 0 |
Compilator | cpp-64 | Status | done |
Runda | pregatire_cls10_oji | Marime | 0.62 kb |
#include <fstream>
#include<iostream>
using namespace std;
ifstream in("cifre5.in");
ofstream out("cifre5.out");
int co[] ={6,2,5,5,4,5,6,3,7,6};
int m[] ={1,5,1,2,2,3,1,2,0,0};
int pf[] ={2,7,2,3,3,4,2,5,1,2};
unsigned long long n,ce,p,s;
int main(){
in>>ce>>n;
if(ce==1)
{
while(n!=0){
s+=co[n%10];
n/=10;
}
out<<s;
return 0;
}
p=1;
while(n!=0){
s+=(long long)1*m[n%10]*p;
p*=(long long)1*pf[n%10];
n/=10;
}
out<<s;
return 0;
}