1 条题解
-
0
- 2024-03-31
- 搜索预处理
#include<bits/stdc++.h> void solve() { int n; std::cin >> n; n -= 4; std::map<int,int> mp; mp[0] = 6; mp[1] = 2; mp[2] = 5; mp[3] = 5; mp[4] = 4; mp[5] = 5; mp[6] = 6; mp[7] = 3; mp[8] = 7; mp[9] = 6; auto divide = [&](int x) { std::vector<int> a; while(x) { a.push_back(mp[x % 10]); x /= 10; } return a; }; for(int i = 10; i <= 1000; i++) { auto a = divide(i); mp[i] = std::accumulate(a.begin(), a.end(), 0); } int ans = 0; for(int i = 0; i <= 500; i++) { for(int j = 0; j <= 500; j++) { if(n == (mp[i] + mp[j] + mp[i + j])) { ans++; } } } std::cout<< ans << "\n"; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int t = 1; while(t--) solve(); return 0; }
- 1
信息
- ID
- 19
- 时间
- 2000ms
- 内存
- 128MiB
- 难度
- 4
- 标签
- 递交数
- 93
- 已通过
- 44
- 上传者