1. 程式人生 > >CF997B Roman Digits

CF997B Roman Digits

dig digi ble strong std pan csdn out rom

思路:

不是很好想的數學題。

參考了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 }

CF997B Roman Digits