Advertisement
Dmaxiya

我是黄色恐龙大将军 参考代码

Mar 30th, 2025
574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long LL;
  5. const int maxn = 100 + 100;
  6.  
  7. LL cal(LL x) {
  8.     int ret = 0;
  9.     while (x != 0) {
  10.         ret = x % 10;
  11.         x /= 10;
  12.     }
  13.     return ret;
  14. }
  15.  
  16. int main() {
  17. #ifdef ExRoc
  18.     freopen("test.txt", "r", stdin);
  19. #endif // ExRoc
  20.     ios::sync_with_stdio(false);
  21.  
  22.     set<LL> st;
  23.     LL tmp2 = 1;
  24.     LL tmp5 = 1;
  25.     for (int i = 0; i < 25; ++i) {
  26.         tmp2 *= 2;
  27.         tmp5 *= 5;
  28.         cout << "i = " << i << ": " << cal(tmp2) * cal(tmp5) << endl;
  29.         st.insert(cal(tmp2) * cal(tmp5));
  30.     }
  31.     int ans = 0;
  32.     for (int x : st) {
  33.         ans += x;
  34.     }
  35.     cout << ans << endl;
  36.  
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement