CF997B Roman Digits

思路:

不是很好想的数学题。

参考了https://blog.csdn.net/litble/article/details/80924306

实现:

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 int main()
 4 {
 5     int n;
 6     while (cin >> n)
 7     {
 8         long long ans = 0;
 9         for (int i = 0; i <= 8 && i <= n; i++)
10         {
11             for (int j = 0; j <= (i == 0 ? 8 : 4) && i + j <= n; j++)
12             {
13                 ans += n + 1 - i - j;
14             }
15         }
16         cout << ans << endl;
17     }
18     return 0;
19 }
原文地址:https://www.cnblogs.com/wangyiming/p/9613167.html