提交时间:2024-01-23 21:39:14
运行 ID: 125710
# include <bits/stdc++.h> using namespace std ; int nums [10] = { 6 , 2 , 5 , 5 , 4 , 5 , 6 , 3 , 7 , 6 } ; int ns ( int x ) { int ans = 0 ; if ( x == 0 ) { return 6 ; } while ( x > 0 ) { ans += nums [x % 10] ; x /= 10 ; } return ans ; } int main ( ) { int n , cnt = 0 ; cin >> n ; n -= 4 ; for ( int i = 0 ; i <= 50 ; i ++ ) { for ( int j = i ; j <= 50 ; j ++ ) { if ( ns ( i ) + ns ( j ) + ns ( i + j ) == n ) { // cout << i << " + " << j << " = " << i + j << endl ; if ( i == j ) { cnt ++ ; } else { cnt += 2 ; } } } } cout << cnt << endl ; return 0 ; }