CodeForces 620B Grandfather Dovlet’s calculator
水题
#include<cstdio> #include<cstring> #include<cmath> #include<stack> #include<vector> #include<string> #include<iostream> #include<algorithm> using namespace std; int x[20]; int main() { int a,b; int ans=0; x[0]=6; x[1]=2; x[2]=5; x[3]=5; x[4]=4; x[5]=5; x[6]=6; x[7]=3; x[8]=7; x[9]=6; scanf("%d%d",&a,&b); for(int i=a;i<=b;i++) { int num=i; while(num) { ans=ans+x[num%10]; num=num/10; } } printf("%d\n",ans); return 0; }