Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
125705 | 梁乃元 | 火柴棒等式 | C++ | 解答错误 | 40 | 0 MS | 252 KB | 672 | 2024-01-23 21:31:48 |
# 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 ) { ans = 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 ; }