Advertisement
Dmaxiya

召唤数学精灵 参考代码

Mar 30th, 2025
460
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 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 sum(LL x) {
  8.     return (1 + x) * x / 2 % 100;
  9. }
  10.  
  11. LL mult(LL x) {
  12.     LL ret = 1;
  13.     for (LL i = 1; i <= x; ++i) {
  14.         ret = ret * i % 100;
  15.     }
  16.     return ret;
  17. }
  18.  
  19. int main() {
  20. #ifdef ExRoc
  21.     freopen("test.txt", "r", stdin);
  22. #endif // ExRoc
  23.     ios::sync_with_stdio(false);
  24.  
  25.     int cnt = 0;
  26.     for (int i = 1; i <= 2000; ++i) {
  27.         if ((sum(i) - mult(i)) % 100 == 0) {
  28.             ++cnt;
  29.             cout << i << ": " << cnt << endl;
  30.         }
  31.     }
  32.     cout << "2024041331404202" << endl;
  33.     cout << "202404133140400" << endl;
  34.     cout <<  "40480826628086" << endl;
  35.  
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement