phuonganhnguyen13042008
Rating
-
Bài tập
15
Điểm
6547
Rating #
-
Điểm #
7411
Giới thiệu
include <bits/stdc++.h>
define mh 10001
using namespace std;
int n,v,a[10]={6,2,5,5,4,5,6,3,7,6},b[mh]={2,7,2,3,3,4,2,4,1,2};
string m;
int one(int t)
{
int tong=0;
for (int i=0;i<t;i++){
tong+=a[m[i]-'0'];
}
return tong;
}
int two(int t)
{
int tong1=1;
for (int i=0;i<t;i++){
if(i==0 && ((m[i]-'0')==1)|| (m[i]-'0')==7) tong1=(b[m[i]-'0']-1);
else tong1=b[m[i]-'0'];
}
return tong1-1;
}
int main()
{
//freopen("LED.INP","r",stdin);
//freopen("LED.OUT","w",stdout);
cin>>v>>m;
//m=to_string(n);
int t=m.length();
if(v==1) cout<<one(t);
if(v==2){
cout<<two(t);
}
}