Advertisement
Dmaxiya

抽奖 参考代码

Apr 12th, 2025
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.02 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long LL;
  5. const int maxn = 1000 + 100;
  6. int n, m, ans;
  7. int x[3], idx[3], num[3];
  8. int a[3][maxn];
  9.  
  10. int cal() {
  11.     if (num[0] == num[1] - 1 && num[1] == num[2] - 1) {
  12.         return 200;
  13.     }
  14.     if (num[0] == num[1] && num[1] == num[2]) {
  15.         return 200;
  16.     }
  17.     sort(num, num + 3);
  18.     if (num[0] == num[1] - 1 && num[1] == num[2] - 1) {
  19.         return 100;
  20.     }
  21.     if (num[0] == num[1] || num[1] == num[2]) {
  22.         return 100;
  23.     }
  24.     return 0;
  25. }
  26.  
  27. int main() {
  28. #ifdef ExRoc
  29.     freopen("test.txt", "r", stdin);
  30. #endif // ExRoc
  31.  
  32.     cin >> n;
  33.     for (int i = 0; i < 3; ++i) {
  34.         for (int j = 0; j < n; ++j) {
  35.             cin >> a[i][j];
  36.         }
  37.     }
  38.     cin >> m;
  39.     for (int i = 0; i < m; ++i) {
  40.         for (int j = 0; j < 3; ++j) {
  41.             cin >> x[j];
  42.             idx[j] = (idx[j] + x[j]) % n;
  43.             num[j] = a[j][idx[j]];
  44.         }
  45.         ans += cal();
  46.     }
  47.     cout << ans << endl;
  48.  
  49.     return 0;
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement