QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#374746#3726. 2017 Revengeucup-team1251Compile Error//C++981.8kb2024-04-02 17:47:072024-04-02 17:47:09

Judging History

你现在查看的是最新测评结果

  • [2024-04-02 17:47:09]
  • 评测
  • [2024-04-02 17:47:07]
  • 提交

answer

#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int mod = 1e9 + 7;
const int N = 3000;
int cnt;
vector<int> prime[3000];
int ksm(int a,int b){
    int ans = 1;
    while(b>1){
        if(b&1){
            ans = ans * a % 2;
        }
        a = a * a % 2;
        b >>= 1;
    }
    return ans;
}
void get_prime(){
    for (int i = 2; i <= 2018;i++){
        for (int j = 2; j <= i;j++){
            if(i%j==0){
                prime[i].push_back(j);
            }
        }
    }
}
void solve()
{   
    int n, r;
    while(cin>>n>>r){
        vector<int> a(n + 1);
        map<int, int> mp, ans;
        for (int i = 1; i <= n; i++)
        {
            cin >> a[i];
            mp[a[i]]++;
        }
        int sum = 0;
        vector<int> vis(3000), vi(3000);
        for (auto i : mp)
        {
            for (auto j : prime[r])
            {
                if (i.first % j == 0)
                {
                    ans[j] += i.second;
                    if (i.first % (r / j) == 0 && r != j)
                        vis[j] += i.second;
                }
            }
        }
        for (auto i : prime[r])
        {
            if (ans[i] > 0 && vi[i] == 0)
            {
                vi[r / i] = 1;
                if (ans[r / i] > 0)
                {
                    sum = sum + (ans[i] * ans[r / i] - vis[i]) % 2;
                    sum = sum + ksm(2, n - (ans[i] + ans[r / i] - vis[i])) % 2;
                }
                else if (i == r)
                {
                    sum = sum + ans[i] * ksm(2, (n - 1)) % 2;
                }
            }
        }
        cout << sum << "\n";
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
    int t = 1;
    get_prime();
    // cin >> t;
    while (t--)
    {
        solve();
    }
}

详细

answer.code: In function ‘void solve()’:
answer.code:41:19: error: ‘i’ does not name a type
   41 |         for (auto i : mp)
      |                   ^
answer.code:52:10: error: expected ‘;’ before ‘for’
   52 |         }
      |          ^
      |          ;
   53 |         for (auto i : prime[r])
      |         ~~~
answer.code:53:9: error: expected primary-expression before ‘for’
   53 |         for (auto i : prime[r])
      |         ^~~
answer.code:52:10: error: expected ‘;’ before ‘for’
   52 |         }
      |          ^
      |          ;
   53 |         for (auto i : prime[r])
      |         ~~~
answer.code:53:9: error: expected primary-expression before ‘for’
   53 |         for (auto i : prime[r])
      |         ^~~
answer.code:52:10: error: expected ‘)’ before ‘for’
   52 |         }
      |          ^
      |          )
   53 |         for (auto i : prime[r])
      |         ~~~
answer.code:41:13: note: to match this ‘(’
   41 |         for (auto i : mp)
      |             ^
answer.code:53:19: error: ‘i’ does not name a type
   53 |         for (auto i : prime[r])
      |                   ^
answer.code:68:10: error: expected ‘;’ before ‘cout’
   68 |         }
      |          ^
      |          ;
   69 |         cout << sum << "\n";
      |         ~~~~
answer.code:70:5: error: expected primary-expression before ‘}’ token
   70 |     }
      |     ^
answer.code:69:29: error: expected ‘)’ before ‘}’ token
   69 |         cout << sum << "\n";
      |                             ^
      |                             )
   70 |     }
      |     ~                        
answer.code:53:13: note: to match this ‘(’
   53 |         for (auto i : prime[r])
      |             ^
answer.code:70:5: error: expected primary-expression before ‘}’ token
   70 |     }
      |     ^