intmain(){ cin >> a >> b >> c; if (a + b == c) f = true; elseif (a - b == c) f = true; elseif (a * b == c) f = true; elseif (a % b == 0 && a / b == c) f = true; if (f) cout << "YES" << endl; else cout << "NO" << endl; }
voidcheck(int sx, int sy, int ex, int ey, bool &f) { int b[5] = {0}; for (int i = sx; i <= ex; i++) for (int j = sy; j <= ey; j++) b[a[i][j]]++; for (int i = 1; i <= 4; i++) { if (b[i] != 1) f = false; } }
voidsolve() { for (int i = 1; i <= 4; i++) for (int j = 1; j <= 4; j++) cin >> a[i][j]; bool f = true; for (int i = 1; i <= 4; i++){ check(i, 1, i, 4, f); check(1, i, 4, i, f); } check(1, 1, 2, 2, f); check(1, 3, 2, 4, f); check(3, 1, 4, 2, f); check(3, 3, 4, 4, f); if (f) cout << "YES" << endl; else cout << "NO" << endl; }
typedeflonglong ls; constint N = 2e5 + 10; constlonglong mod = 998244353; int t;
voidsolve() { map<int, int> mp; int n; cin >> n; for (int i = 0; i < n; i++) { int x; cin >> x; mp[x]++; } ls sum = 0; int last = 0; //上一个数是什么 ls p = 1; //之前的阶乘和 for (auto [s, e] : mp){ if (s - last == 1 && e >= 2){ ls k = (1LL * e*(e-1)/2) % mod;//转成long long类型 p = (p * k) % mod; sum = (sum + p) % mod; last = s; } elsebreak; } cout << sum << endl; }
intmain(){ ios::sync_with_stdio(0);cin.tie(0); cin >> t; while (t--) solve(); }