1 条题解

  • 1
    @ 2025-5-12 18:13:27
    #include <bits/stdc++.h>
    using namespace std;
    
    #define int long long
    #define double long double
    #define endl "\n"
    
    int mod = 6421;
    
    int ksm(int a, int b)
    {
    	int c = 1;
    	while (b)
    	{
    		if (b % 2)
    			c = c * a % mod;
    		b /= 2;
    		a = a * a % mod;
    	}
    	return c;
    }
    
    void solve()
    {
    	int n = 20240601;
    	
    	map<int, int> mp;
    	for (int i = 1; i <= n; i++)
    		mp[ksm(i % mod, i)]++;
    	
    	int ans = mp[0] * (mp[0] - 1) / 2;
    	for (int i = 1; i < mod - i; i++)
    		ans += mp[i] * mp[mod - i];
    	cout << ans << endl;
    }
    
    signed main()
    {
    	ios::sync_with_stdio(0);
    	cin.tie(0);
    	cout.tie(0);
    	cout << fixed << setprecision(10);
    	
    	int t = 1;
    	// cin >> t;
    	while (t--)
    		solve();
    	
    	return 0;
    }
    
    • 1

    信息

    ID
    144
    时间
    1000ms
    内存
    256MiB
    难度
    9
    标签
    递交数
    11
    已通过
    4
    上传者