text
stringlengths
49
983k
#include <bits/stdc++.h> using namespace std; int main() { int n, b, c; int a; cin >> n >> a >> b >> c; int ans = 0; for (int i = 0; i <= b; i++) { for (int j = 0; j <= c; j++) { int p = n - (j * 2 + i); if (p >= 0 && p <= a / 2) ans++; } } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; const int INF = (int)2e9; const double PI = (double)acos(-1.0); const double EPS = (double)1e-9; const int MOD = (int)1e9 + 7; int dat[20005]; inline void display(int n) { for (int i = 0; i <= n; i += 1) printf("%d ", dat[i]); puts(""); } int main() { for (int i = 0; i <= 20003 - 1; i += 1) dat[i] = 0; dat[0] = 1; int n, a, b, c; scanf("%d %d %d %d", &n, &a, &b, &c); n *= 2; for (int i = n; i >= 1; i -= 1) for (int j = 1; j <= c; j += 1) { if (i - (j << 2) < 0) break; dat[i] += dat[i - (j << 2)]; } for (int i = n; i >= 1; i -= 1) for (int j = 1; j <= b; j += 1) { if (i - (j << 1) < 0) break; dat[i] += dat[i - (j << 1)]; } for (int i = n; i >= 1; i -= 1) for (int j = 1; j <= a; j += 1) { if (i - (j << 0) < 0) break; dat[i] += dat[i - (j << 0)]; } printf("%d\n", dat[n]); return 0; }
#include <bits/stdc++.h> using namespace std; void solve() { long long n, a, b, c, ct = 0; cin >> n >> a >> b >> c; for (long long i = 0; i <= a; i += 2) { for (long long j = 0; j < b + 1; j++) { long long d = (n - (i / 2) - j); if (d % 2 == 0 && c >= (d / 2) && (d / 2) >= 0) ct++; } } cout << ct << "\n"; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); ; long long t = 1; while (t--) { solve(); } }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c; cin >> n >> a >> b >> c; int count = 0; for (int sc = 0; sc <= min(n, 2 * c); sc += 2) { for (int sb = 0; sb <= min(n - sc, b); sb++) { if (n - sb - sc <= a / 2) count++; } } cout << count; return 0; }
#include <bits/stdc++.h> using namespace std; void solve() { int n, x, y, z, ans = 0; cin >> n >> x >> y >> z; for (long long i = 0; i <= x / 2; i++) { for (long long j = 0; j <= y; j++) { if ((n - (i + j)) % 2 == 0 && (n - (i + j)) / 2 <= z && (n - (i + j)) / 2 >= 0) ans++; } } cout << ans; } int main() { int t = 1; while (t--) { solve(); } return 0; }
#include <bits/stdc++.h> using namespace std; int n, a, b, c, ans; int main() { cin >> n >> a >> b >> c; for (int i = 0; i <= c; i++) { for (int j = 0; j <= b; j++) { int x = n - i * 2 - j; if (x >= 0 && a * 0.5 >= x) ans++; } } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, counter = 0; cin >> n >> a >> b >> c; for (int i = 0; i <= a; i++) { for (int j = 0; j <= b; j++) { if (n - i * 0.5 - j <= c * 2 && fmod(n - i * 0.5 - j, 2) == 0 && n - i * 0.5 - j >= 0) counter++; } } cout << counter; return 0; }
#include <bits/stdc++.h> using namespace std; long double pi = 3.1415927535897932384626433; template <typename T, typename U> static inline void amin(T &x, U y) { if (y < x) x = y; } template <typename T, typename U> static inline void amax(T &x, U y) { if (x < y) x = y; } long long cdiv(long long a, long long b) { return a / b + ((a ^ b) > 0 && a % b); } long long fdiv(long long a, long long b) { return a / b - ((a ^ b) < 0 && a % b); } long long max(long long a, long long b, long long c) { return max(a, max(b, c)); } long long min(long long a, long long b, long long c) { return min(a, min(b, c)); } long long gcd(long long a, long long b) { if (b == 0) return (a); else return (gcd(b, a % b)); } void _good_for_nothing_() { long long n, a, b, c; cin >> n >> a >> b >> c; long long cnt = 0; n *= 2; for (long long i = 0; i < a + 1; i++) { for (long long j = 0; j < b + 1; j++) { long long temp = i + 2 * j; long long third = (n - temp) / 4; if (third == cdiv((n - temp), 4) and third <= c and third >= 0 and third == fdiv((n - temp), 4)) cnt++; } } cout << cnt; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long TESTS = 1; while (TESTS--) _good_for_nothing_(); return 0; }
#include <bits/stdc++.h> using namespace std; int eprintf(const char *format, ...) { return 0; } int main() { int n, a, b, c; while (scanf("%d%d%d%d", &n, &a, &b, &c) >= 4) { long long ans = 0; for (int a1 = 0; a1 <= a; a1 += 2) for (int b1 = 0; b1 <= b; b1++) { int rem = n - (a1 >> 1) - b1; if (rem < 0) break; if (!(rem & 1) && (rem <= c * 2)) ans++; } printf("%I64d\n", ans); break; } return 0; }
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } long long lcm(long long a, long long b) { return a * (b / (gcd(a, b))); } inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; } inline long long toLL(string s) { long long v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } using namespace std; long long n; int a, b, c; int main() { std::ios_base::sync_with_stdio(false); long long n; cin >> n; cin >> a >> b >> c; n *= 10; int ways = 0; for (int i = 0; i <= a; i++) { for (int j = 0; j <= b; j++) { long long rem = n - (5 * i + 10 * j); if (rem >= 0 && rem % 20 == 0) { if (rem / 20 <= c) ++ways; } } } cout << ways << "\n"; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, n; cin >> n >> a >> b >> c; int count = 0; for (int i = 0; i <= b; i++) { for (int j = 0; j <= c; j++) { int num = n - i - 2 * j; if (num >= 0 && 2 * num <= a) count++; } } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; long long dp[3][30010]; int main() { int i, n, m, j, a, b, c; while (scanf("%d%d%d%d", &n, &a, &b, &c) != EOF) { n *= 2; memset(dp, 0, sizeof(dp)); for (i = 1; i <= a; i++) dp[0][i] = 1; dp[0][0] = 1; for (i = 1; i <= b; i++) for (j = n; j >= i * 2; j--) dp[1][j] += dp[0][j - i * 2]; for (i = 0; i <= n; i++) dp[1][i] += dp[0][i]; for (i = 0; i <= n; i++) dp[2][i] = dp[1][i]; for (i = 1; i <= c; i++) for (j = n; j >= i * 4; j--) dp[2][j] += dp[1][j - i * 4]; cout << dp[2][n] << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; long long ans = 0; int main() { int a, b, c, n; cin >> n >> a >> b >> c; a = a / 2; ans = 0; for (int i = 0; i <= a; i++) for (int j = 0; j <= b; j++) if (i + j <= n && i + j + 2 * c >= n && (n - i - j) % 2 == 0) ans++; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, ans; cin >> n >> a >> b >> c; swap(a, c); ans = 0; for (int i = 0; i <= a; i++) for (int j = 0; j <= b; j++) { int t = (n - i * 2 - j) * 2; if (t <= c && t >= 0) ans++; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; long long ans = 0, n, b, c, i, j, x, y; int main() { scanf("%lld%lld%lld%lld", &n, &x, &y, &c); b = x / 2 + y; for (i = 0; i <= b; i++) for (j = 0; j <= c; j++) if (i + j * 2 == n) { if (j * 2 == n) { ans++; continue; } if (max(x / 2, y) >= i) ans += min(i + 1, min(x / 2, y) + 1); else ans += min(x / 2, y) - (i - max(x / 2, y)) + 1; } printf("%lld\n", ans); return 0; }
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const long long inf = 1e18; int a[105]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, a, b, c; cin >> n >> a >> b >> c; int ans = 0; for (int i = 0; i <= a; i += 2) { for (int j = 0; j <= b; j++) { int left = n - i / 2 - j; if (left >= 0 && left % 2 == 0 && 2 * c >= left) ans++; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; const int INF = 1000 * 1000 * 1000; const double EPS = 1e-9; int main() { int n, a, b, c; cin >> n >> a >> b >> c; n *= 2; int cnt = 0; for (int i = 0; i <= a; ++i) for (int j = 0; j <= b; ++j) { int cur = i + 2 * j; if (n >= cur && !((n - cur) % 4) && (n - cur) / 4 <= c) ++cnt; } cout << cnt; return 0; }
#include <bits/stdc++.h> using namespace std; void solve(); int main() { ios::sync_with_stdio(0); solve(); return 0; } void solve() { int n, a, b, c; cin >> n >> a >> b >> c; long long cnt = 0; for (int i = 0; i <= b; i++) { for (int j = 0; j <= c; j++) { int v = n - i - 2 * j; if (v >= 0) { v *= 2; if (v <= a) ++cnt; } } } cout << cnt << '\n'; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, cnt = 0; cin >> n >> a >> b >> c; for (int i = 0; i <= a; ++i) { for (int j = 0; j <= b; ++j) { if (i % 2) continue; int aldik = i / 2 + j; int kaldi = n - aldik; if (aldik > n) continue; if (kaldi % 2 == 0 && kaldi / 2 <= c) cnt++; } } cout << cnt; }
#include <bits/stdc++.h> using namespace std; using namespace std; int d[40000 + 20]; int main() { int i, j, k, t, m, n; int a, b, c; cin >> n >> a >> b >> c; for (i = 0; i <= a; i++) { for (j = 0; j <= b; j++) { if (i + 2 * j > 2 * n) continue; else d[i + 2 * j]++; } } int ans = 0; for (i = 0; i <= c; i++) { int rest = 2 * n - 4 * i; if (rest >= 0) ans += d[rest]; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9; long long gcd(long long a, long long b) { return (a ? gcd(b % a, a) : b); } long long power(long long a, long long n) { long long p = 1; while (n > 0) { if (n % 2) { p = p * a; } n >>= 1; a *= a; } return p; } int main() { ios_base::sync_with_stdio(false); long long n, a, b, c, ans = 0, k; cin >> n >> a >> b >> c; for (int i = 0; i <= a; i += 2) { for (int j = 0; j <= b; j++) { ans += ((n - i / 2 - j) % 2 == 0 && (n - i / 2 - j) >= 0 && (n - i / 2 - j) / 2 <= c); } } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c; cin >> n >> a >> b >> c; int ans = 0; for (int i = 0; i <= a; i += 2) { for (int j = 0; j <= b && n >= i * 0.5 + j; j++) { int left = n - i * 0.5 - j; if (left % 2 == 0 && left / 2 <= c) ans++; } } cout << ans; return 0; }
#include <bits/stdc++.h> int main() { int n, a, b, c, sum = 0, i, j; int d[10001] = {0}; scanf("%d %d %d %d", &n, &a, &b, &c); for (i = 0; i <= a / 2; i++) d[i]++; for (i = a / 2; i >= 0; i--) { for (j = 1; j <= b && i + j <= n; j++) { d[i + j]++; } } for (i = 0; i <= c; i++) { if (n - i * 2 >= 0) sum += d[n - i * 2]; } printf("%d\n", sum); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b, c; cin >> n >> a >> b >> c; long long ans = 0; if (n > a * .5 + b + c * 2) { cout << 0 << endl; return 0; } for (int i = 0; i <= b; i++) { for (int j = 0; j <= c; j++) { long long x = n - i - j * 2; if (x >= 0 && x * 2 <= a) { ans++; } } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> int dp[30000]; int f[30000]; int num[5]; int main() { int i, j, k; int n; int a[5]; num[0] = 1, num[1] = 2, num[2] = 4; while (scanf("%d%d%d%d", &n, &a[0], &a[1], &a[2]) != EOF) { for (i = 0; i <= 2 * n; i++) dp[i] = 0; dp[0] = 1; for (i = 0; i < 3; i++) { int tmp = 2 * n; for (j = 0; j <= tmp; j++) f[j] = 0; for (k = 0; k <= a[i]; k++) { for (j = tmp; j >= k * num[i]; j--) { f[j] += dp[j - k * num[i]]; } } for (j = 0; j <= tmp; j++) dp[j] = f[j]; } printf("%d\n", dp[2 * n]); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n, a, b, c, k; long long ans = 0; cin >> n >> a >> b >> c; for (int i = 0; i <= a; i += 2) { for (int j = 0; j <= c; j++) { k = i / 2 + j * 2; if (k > n) break; else if (n - k <= b) ans++; } } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long n, ma, mb, mc; cin >> n >> ma >> mb >> mc; long k = 0; for (long a = 0; a <= ma; a++) for (long b = 0; b <= mb; b++) { long c = 2 * n - a - 2 * b; if (c % 4 || c < 0 || c > 4 * mc) ; else k++; } cout << k << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, total; long long num_ways; num_ways = total = 0; cin >> n >> a >> b >> c; for (int numb = 0; numb <= b; numb++) { for (int numc = 0; numc <= c; numc++) { total = numb + 2 * numc; if (total == n) num_ways++; if (total < n) { if (2 * (n - total) <= a) num_ways++; } } } cout << num_ways; }
#include <bits/stdc++.h> using namespace std; int main() { long double n, a, b, c, one, two; cin >> n >> a >> b >> c; long long int count = 0; for (int i = 0; i <= c; i++) { for (int j = 0; j <= b; j++) { one = j + (2 * i); if (n - one >= 0 && (.5 * a) >= n - one) { count++; } } } cout << count << endl; }
#include <bits/stdc++.h> using namespace std; int n, res, a, b, c; int main() { cin >> n >> a >> b >> c; for (int i = 0; i <= a; i++) if (i % 2 == 0) for (int j = 0; j <= b; j++) { int s = i / 2 + j; if (s > n) continue; if ((n - s) % 2 == 0 && n - s <= c * 2) res++; } cout << res << endl; return 0; }
#include <bits/stdc++.h> int main() { int n, a, b, c; int v, r(0); std::scanf("%d%d%d%d", &n, &a, &b, &c); n *= 2; for (int i(0); i <= a; ++i) { v = n - i; for (int j(0); j <= b && 0 <= v; ++j) { r += (v % 4 == 0) & (v / 4 <= c); v -= 2; } } std::printf("%d\n", r); return 0; }
/* 2013-08-11 08:59:57.373420 */#include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <cmath> #include <iostream> #include <algorithm> using namespace std; int n, A, B, C; int main(){ //freopen("b.in", "r", stdin); scanf("%d%d%d%d", &n, &A, &B, &C); int ans = 0; for (int i = 0; i <= A; i++) for (int j = 0; j <= B; j++) { int Left = 2 * n - i - 2 * j; if (Left % 4) continue; Left /= 4; if (Left >= 0 && Left <= C) ++ans; } printf("%d\n", ans); }
#include <bits/stdc++.h> using namespace std; map<int, int> mp; vector<int> tz; map<int, int>::iterator mt; int main() { int ans = 0; int n, a, b, c; cin >> n >> a >> b >> c; int x, y, z = 0; n = 2 * n; for (x = 0; x <= a; ++x) for (y = 0; y <= b; ++y) mp[x + 2 * y]++; int sz = mp.size(); int arr1[sz], cnt[sz]; int i = 0; for (mt = mp.begin(); mt != mp.end(); mt++) { arr1[i] = (*mt).first; cnt[i] = (*mt).second; i++; } for (z = 0; z <= c; z++) tz.push_back(n - 4 * z); for (int j = 0; j < (int)tz.size(); j++) { int num = tz[j]; int id = -1; int left = 0, right = i - 1, middle; while (left <= right) { middle = (left + right) / 2; if (arr1[middle] == num) { id = middle; break; } else if (arr1[middle] < num) { left = middle + 1; } else { right = middle - 1; } } if (id != -1) ans += cnt[id]; } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int a, b, c, n, ans = 0; cin >> n >> a >> b >> c; for (int i = 0; i <= a; i += 2) { for (int j = 0; j <= b; j++) { int rem = n - i / 2 - j; if (rem % 2 == 0 && rem > -1 && (rem / 2) <= c) ans++; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long i, j, n, a, b, c, summ = 0; cin >> n; cin >> a >> b >> c; for (i = 0; i <= n / 2 && i <= c; i++) for (j = 0; j <= n && j <= b; j++) if (2 * i + j <= n && (n - 2 * i - j) * 2 <= a) summ++; cout << summ; cin >> i; return 0; }
#include <bits/stdc++.h> using namespace std; int n, a, b, c, x, y, z, ans; int u[15000]; int main() { cin >> n >> a >> b >> c; ans = 0; memset(u, 0, sizeof(u)); for (x = 0; x <= a; x += 2) { for (y = 0; y <= b; ++y) { z = (n - (x * 0.5 + y)) / 2; if ((z * 2 + y + floor(x * 0.5)) != n) continue; if (z >= 0 && z <= c) { if (u[x + y + z] == 0) { ans++; } } } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const long long N = 25; int main() { long long n, a, b, c, ans, i, j; cin >> n >> a >> b >> c; ans = 0; for (i = 0; i <= c; i++) { for (j = 0; j <= b; j++) { long long temp = n - j - i * 2; ans += (temp >= 0 && temp <= a / 2); } } cout << ans << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, ans = 0; double now, k; cin >> n >> a >> b >> c; for (int i = 0; i <= min(n / 2, c); i++) { for (int j = 0; j <= min(n, b); j++) { now = i * 2.0 + j * 1.0; if (now > n) continue; k = (n * 1.0 - now) * 2; if (k <= a) ans++; } } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int n, a, b, c; int main() { scanf("%d %d %d %d", &n, &a, &b, &c); int ans = 0; for (int i = 0; i <= c; i++) { for (int j = 0; j <= b; j++) { int k = (n - 2 * i - j) * 2; if (k >= 0 && k <= a) ans++; } } printf("%d\n", ans); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, i, j, a, b, c, ans; while (~scanf("%d%d%d%d", &n, &a, &b, &c)) { ans = 0; for (i = 0; i <= c; i++) for (j = 0; j <= b; j++) { int t = n - i * 2 - j; if (t >= 0 && a / 2 >= t) ans++; } printf("%d\n", ans); } return 0; }
#include <bits/stdc++.h> using namespace std; int n, a, b, c, ans; int main() { cin >> n >> a >> b >> c; for (int i = 0; i <= a; i++) for (int j = 0; j <= b; j++) if (2 * n - (i + 2 * j) >= 0) if (2 * n - (i + 2 * j) <= 4 * c) ans += ((2 * n - (i + 2 * j)) % 4 == 0); cout << ans; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, cnt = 0; cin >> n >> a >> b >> c; n *= 10; for (int i = 0; i <= a; i++) { for (int j = 0; j <= b; j++) { if (i * 5 + j * 10 <= n && (n - (i * 5 + j * 10)) % 20 == 0 && (n - (i * 5 + j * 10)) / 20 <= c) cnt++; } } cout << cnt; return 0; }
#include <bits/stdc++.h> using namespace std; int n, a, b, c; int main() { cin >> n >> c >> b >> a; n *= 2; long long sum = 0; for (int i = 0; i <= a; i++) { for (int j = 0; j <= b; j++) { if ((n - ((i * 4) + (j * 2)) <= c) && (n - ((i * 4) + (j * 2)) >= 0)) { sum++; } } } cout << sum << endl; return 0; }
#include <bits/stdc++.h> int main() { int n, a, b, c; while (scanf("%d%d%d%d", &n, &a, &b, &c) == 4) { int ans = 0; for (int i = 0; i <= n / 2 && i <= c; i++) { for (int j = 0; 2 * i + j <= n && j <= b; j++) { int k = n - (2 * i + j); k *= 2; if (k >= 0 && k <= a) ans++; } } printf("%d\n", ans); } }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c; cin >> n >> a >> b >> c; n *= 10; int sum = 0; for (int i = 0; i <= min(a, n / 5); i++) { int t = n - i * 5; for (int j = 0; j <= min(b, t / 10); j++) { int p = t - j * 10; if (p % 20 == 0 && p / 20 <= c) sum++; } } cout << sum << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int possibilies(int n, int c, int b, int a) { int result = 0; for (int i = 0; i <= a; i++) { for (int j = min(n - (2 * i), b); j >= 0; j--) { int z = (n - (2 * i) - j) * 2; if (z <= c) { result += 1; } } } return result; } int main(int argc, const char* argv[]) { int n = 10, a = 5, b = 5, c = 5; cin >> n >> a >> b >> c; std::cout << possibilies(n, a, b, c); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, k, t; int ans = 0, i, j; cin >> n >> a >> b >> c; for (i = 0; i <= a; i += 2) { for (j = 0; j <= b; j++) { t = n - i / 2 - j; if (t == 0) { ans++; } else { if (t % 2 == 0) { k = t / 2; if ((k <= c) && (k > 0)) { ans++; } } } } } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int a, b, c; int n, i, j, k, ans; int main() { scanf("%d%d%d%d", &n, &a, &b, &c); n *= 10; ans = 0; for (i = 0; i <= c; i++) for (j = 0; j <= b; j++) if ((n - 10 * j - 20 * i) % 5 == 0 && (n - 10 * j - 20 * i >= 0) && (n - 10 * j - 20 * i) / 5 <= a) ans++; printf("%d\n", ans); return 0; }
#include <bits/stdc++.h> int main() { int n, a, b, c; scanf("%i%i%i%i", &n, &a, &b, &c); n *= 2; int res = 0; for (int i = 0; i <= a; i++) { for (int j = 0; j <= b; j++) { if (i + 2 * j > n) break; int k = n - (i + 2 * j); if (k % 4 == 0 && k / 4 <= c) { res++; } } } printf("%i\n", res); }
#include <bits/stdc++.h> using namespace std; const int maxn = 200005; long long n, a, b, c; long long Map[maxn]; int main() { while (scanf("%I64d%I64d%I64d%I64d", &n, &a, &b, &c) == 4) { memset(Map, 0, sizeof(Map)); for (long long x1 = 0; x1 <= a; x1++) for (long long x2 = 0; x2 <= b; x2++) { long long cur = x1 + 2 * x2; if (cur > 2 * n) continue; Map[cur]++; } long long ans = 0; for (long long x3 = 0; x3 <= c; x3++) { long long rest = 2 * n - 4 * x3; if (rest >= 0) ans += Map[rest]; } printf("%I64d\n", ans); } return 0; }
#include <bits/stdc++.h> using namespace std; template <class T> void show(T a, int n) { for (int i = 0; i < n; ++i) cout << a[i] << ' '; cout << endl; } template <class T> void show(T a, int r, int l) { for (int i = 0; i < r; ++i) show(a[i], l); cout << endl; } const int N = 128 * 2; const int M = 5000; const int oo = 10000 * 10000 * 10; int n, a, b, c; int cal(int tn) { int lo = (n - 2 * b > 0 ? n - 2 * b : 0); int hi = (a < tn ? a : tn); if (lo > hi) return 0; int ans = (hi - lo + 1) / 2; if ((hi - lo + 1) % 2 == 0) return ans; if (tn % 2 == hi % 2) { return ans + 1; } else return ans; } int main() { int i, j, cas = 0; cin >> n >> a >> b >> c; n += n; long long ans = 0; for (; n >= 0 && c >= 0; n -= 4, c--) { ans += cal(n); } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const long long N = 100005; const long long INF = 1e18; const int32_t M = 1e9 + 7; const int32_t MM = 998244353; template <typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2>& a) { in >> a.first >> a.second; return in; } template <typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> a) { out << a.first << " " << a.second; return out; } template <typename T, typename T1> T amax(T& a, T1 b) { if (b > a) a = b; return a; } template <typename T, typename T1> T amin(T& a, T1 b) { if (b < a) a = b; return a; } void solve() { long long n, a, b, c, ans = 0; cin >> n >> a >> b >> c; for (long long i = 0; i <= c && 2 * i <= n; i++) { for (long long j = 0; j <= min(b, n - 2 * i); j++) { long long need = n - (2 * i + j); if (need * 2 <= a) { ans++; } } } cout << ans << "\n"; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long t = 1; while (t--) { solve(); } return 0; }
#include <bits/stdc++.h> int a, b, c, n; int s; int main() { scanf("%d%d%d%d", &n, &a, &b, &c); a >>= 1; c <<= 1; for (register int i = 0; i <= a; ++i) for (register int j = 0; j <= b; ++j) { int x = i + j; if (x > n) break; if (x + c >= n && !((n - x) & 1)) s++; } printf("%d", s); }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c; int res = 0; cin >> n >> a >> b >> c; for (int i = 0; i <= a; i += 2) for (int j = 0; j <= c; j += 1) { int x = n - 0.5 * i - 2 * j; if ((x >= 0) && (x <= b)) res++; } cout << res; }
#include <bits/stdc++.h> using namespace std; vector<int> arr1, arr2, rpt, sum1, sum2; int main() { double n, a, b, c; cin >> n >> a >> b >> c; int r = 0; n *= 2; for (int i = 0; i < c + 1; i++) for (int j = 0; j < b + 1; j++) if (n - 4 * i - 2 * j >= 0 && n - 4 * i - 2 * j <= a) r++; cout << r << endl; }
#include <bits/stdc++.h> using namespace std; const int N = 10005; int main() { int n, a, b, c, d, t, mi, ma; int i, j, k, x, y, z; long ans; while (scanf("%d%d%d%d", &n, &a, &b, &c) != EOF) { ans = 0; a = a / 2; c = c * 2; mi = n - a - b; if (mi < 0) mi = 0; if (mi % 2 != 0) mi = mi / 2 * 2 + 2; ma = min(n, c); for (i = mi; i <= ma; i += 2) { t = n - i; x = t - b; if (x < 0) x = 0; y = min(t, a); ans += y - x + 1; } printf("%ld\n", ans); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, ans = 0, i, j, k; cin >> n >> a >> b >> c; for (i = 0; i <= n * 2 && i <= a; i += 2) { for (j = 0; j <= n - i / 2 && j <= b; j++) { k = n - i / 2 - j; if (k & 1) continue; if (k / 2 > c) continue; ans++; } } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; const int inf(1010101010); int n, a, b, c; long long s(0); int main() { cin >> n >> a >> b >> c; n *= 2; for (int nA(0); nA <= a; nA++) for (int nB(0); nB <= b; nB++) { int tot(nA + nB * 2); if (tot % 4 != n % 4) continue; int nC((n - tot) / 4); if (0 <= nC && nC <= c) s += 1; } cout << s << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c; int res = 0; cin >> n >> a >> b >> c; for (int i = 0; i <= a; i += 2) for (int j = 0; j <= b; j++) if ((n >= (i / 2 + j)) && ((n - (i / 2 + j)) % 2 == 0) && ((n - (i / 2 + j)) / 2 <= c)) res++; cout << res; return 0; }
#include <bits/stdc++.h> using namespace std; int n, a, b, c, res, ans = 0; int main(void) { ios ::sync_with_stdio(0); cin.tie(0); cin >> n >> a >> b >> c; for (int y = 0; y <= b; ++y) { for (int z = 0; z <= c; ++z) { res = n - y - 2 * z; if (res >= 0 && res * 2 <= a) { ++ans; } } } cout << ans << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; long long j, k, s, l, m, n, t, d; long long e[111][33333], a, b, i, p, c; map<string, long long> y; string q, r, w; int main() { cin >> n >> a >> b >> c; n *= 2; for (i = 0; i <= a; i++) { for (j = 0; j <= b; j++) { k = n - i - 2 * j; if (k % 4 == 0 && k / 4 <= c && k >= 0) s++; } } cout << s; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int liters, half, one, two, c = 0, temp; cin >> liters >> half >> one >> two; if (half % 2 != 0) half = (half - 1) * 0.5; else half = half * 0.5; two = two * 2; for (int i = half; i >= 0; i--) { for (int j = one; j >= 0; j--) { temp = liters - (i + j); if (temp >= 0 && temp % 2 == 0 && two >= temp) c++; } } cout << c << endl; return 0; }
#include <bits/stdc++.h> int main() { int n, p, q, r, b, c, s = 0, a, i, j, k; double u, m, w, l, t; scanf("%d %d %d %d", &n, &p, &q, &r); for (i = 0; i <= p; i++) { for (j = 0; j <= q; j++) { m = 0.5 * i + j; if (m == n) { s = s + 1; } else if (m > n) { break; } else { t = n - m; a = (int)t; if (t - a == 0) { if (a % 2 == 0 && (a / 2) <= r) { s = s + 1; } } } } } printf("%d", s); return 0; }
#include <bits/stdc++.h> int main() { int n, a, b, c; int i, j, sum; while (scanf("%d%d%d%d", &n, &a, &b, &c) != EOF) { sum = 0; for (i = 0; i <= b; i++) { for (j = 0; j <= n - i && j <= c; j++) { if ((a / 2) >= (n - i - j * 2) && (n - i - j * 2) >= 0) { sum++; } } } printf("%d\n", sum); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c; cin >> n >> a >> b >> c; int total = 0; for (int i = 0; i <= c; i++) { for (int j = 0; j <= b; j++) { if (i * 2 + j > n) break; int l = (n - (2 * i + j)); if (2 * l <= a) total++; } } cout << total << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.precision(20); long long int n, a, b, c, d = 0; cin >> n >> a >> b >> c; for (int i = 0; i <= c; i++) { for (int j = 0; j <= b; j++) { long long int x = 2 * n - 4 * i - 2 * j; if (a == 0) { if (x == 0) d++; } else { if (x >= 0 && x <= a) d++; } if (x < 0) break; } } cout << d; }
#include <bits/stdc++.h> using namespace std; const int N = 20100; int b[N], c[N], x, y, z, n; int main() { int i, j, l; while (scanf("%d%d%d%d", &n, &x, &y, &z) != EOF) { if (x + y * 2 + z * 4 < n) { printf("0\n"); break; } n *= 2; for (i = 0; i <= x; i++) b[i] = 1; for (; i < N; i++) b[i] = 0; for (i = 0; i < N; i++) c[i] = 0; for (i = 0; i < N; i++) for (j = 0; j + i < N && j <= y * 2; j += 2) c[i + j] += b[i]; for (i = 0; i < N; i++) b[i] = c[i]; for (i = 0; i < N; i++) c[i] = 0; for (i = 0; i < N; i++) for (j = 0; j + i < N && j <= z * 4; j += 4) c[i + j] += b[i]; printf("%d\n", c[n]); } return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, n2, n3; while (cin >> n) { cin >> a >> b >> c; n = n * 2; int ans = 0; for (int i = c; i >= 0; i--) { if (4 * i > n) continue; n2 = n - 4 * i; for (int j = b; j >= 0; j--) { if (2 * j > n2) continue; n3 = n2 - 2 * j; if (n3 >= 0 && n3 <= a) ans++; } } cout << ans << endl; } return 0; }
#include <bits/stdc++.h> int main() { int n, a, b, c, i, j, ss; long long sum; while (~scanf("%d%d%d%d", &n, &a, &b, &c)) { sum = 0; a = a / 2; for (i = 0; i <= a; i++) { for (j = 0; j <= c; j++) { ss = n - i - j * 2; if (ss <= b && ss >= 0) { sum++; } } } printf("%lld\n", sum); } }
#include <bits/stdc++.h> using namespace std; int A, B, C, N, x, tmp; int main(void) { scanf("%d%d%d%d", &N, &A, &B, &C); x = 0; for (int y = 0; y <= B; y++) for (int z = 0; z <= C; z++) { tmp = 2 * (N - y - 2 * z); if (tmp >= 0 && tmp <= A) x++; } printf("%d", x); return 0; }
#include <bits/stdc++.h> using namespace std; long long n, a, b, c, sum[100010], tot, ans; inline long long read() { long long cnt = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { cnt = cnt * 10 + ch - 48; ch = getchar(); } return cnt * f; } int main() { n = read(); a = read(); b = read(); c = read(); for (int i = 0; i <= a; i += 2) for (int j = 0; j <= b; j++) sum[(int)(i * 0.5 + j)]++; for (int i = 0; i <= c && n - i * 2 >= 0; i++) ans += sum[n - i * 2]; printf("%lld\n", ans); return 0; }
#include <bits/stdc++.h> using namespace std; int n, a, b, c; int main() { scanf("%d%d%d%d", &n, &a, &b, &c); n *= 2; int n_; int res = 0; for (int a_ = 0; a_ < a + 1; ++a_) for (int b_ = 0; b_ < b + 1; ++b_) { n_ = n - a_ - (b_ << 1); if (n_ < 0) continue; if (n_ & 3) continue; n_ >>= 2; if (n_ <= c) ++res; } printf("%d\n", res); return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int sum, a, b, c, ans = 0; cin >> sum >> a >> b >> c; for (int i = 0; i <= a; i += 2) for (int j = 0; j <= c; ++j) if (sum - i / 2 - 2 * j <= b && sum - i / 2 - 2 * j >= 0) ans++; cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, counter = 0, rem = 0; cin >> n >> a >> b >> c; for (int i = 0; i <= a; i += 2) { for (int j = 0; j <= b; j++) { rem = n - (i / 2) - j; if (rem % 2 == 0 && rem <= (c * 2) && rem >= 0) { if (((i / 2) + j + (rem)) == n) { counter++; } } } } cout << counter << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, i, j, k, l, p = 0, q, x, y, z; scanf("%lld %lld %lld %lld", &n, &m, &k, &l); x = l * 2; x = min(x, n); i = x / 2; for (; i >= 0; i--) { x = i * 2; x = n - x; x = min(x, k); for (j = x; j >= 0; j--) { y = (i * 2) + j; y = n - y; y *= 2; if (y <= m) p++; } } printf("%lld", p); }
#include <bits/stdc++.h> using namespace std; int n, a, b, c, f = 0; int main() { cin >> n >> a >> b >> c; for (int i = 0; i <= c; i++) { for (int j = 0; j <= b; j++) { if (n - j - 2 * i >= 0 && n - j - 2 * i <= a / 2) { f++; } } } cout << f; }
#include <bits/stdc++.h> using namespace std; int n, a, b, c; int main() { cin >> n >> a >> b >> c; int ans = 0; for (int i = 0; i < (int)(b + 1); ++i) for (int j = 0; j < (int)(c + 1); ++j) { int cnt = n - i - 2 * j; if (cnt >= 0 && 2 * cnt <= a) { ++ans; } } cout << ans << endl; return 0; }
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; const long long q[] = {1, 2, 4}; int main() { long long n, a, b, c; while (cin >> n >> a >> b >> c) { n *= 2; long long ans = 0; for (int i = 0; i <= a; i++) { for (int j = 0; j <= b; j++) { long long sum = q[0] * i + q[1] * j; if ((n - sum) >= 0 && (n - sum) / 4 <= c && (n - sum) % 4 == 0) ans += 1; } } cout << ans << endl; } }
#include <bits/stdc++.h> #pragma comment(linker, "/STACK:16777216") using namespace std; int n, a, b, c, ans = 0; int main() { cin >> n >> a >> b >> c; for (int i = 0; i <= a; i += 2) for (int j = 0; j < (int)(b + 1); j++) { int k = n - (i * 0.5 + j); if (k < 0) break; if (!k) { ans++; continue; } if (k % 2 == 0) { int l = k / 2; if (l <= c) ans++; } } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, res = 0, remain; cin >> n >> a >> b >> c; for (int i = 0; i <= a; i += 2) { if (i / 2 > n) break; for (int j = 0; j <= b; j++) { remain = n - (i / 2); if (remain < j) continue; remain -= j; if (remain % 2 != 0) continue; if (remain / 2 > c) continue; res++; } } cout << res << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main(void) { int n, a, b, c, ans = 0; cin >> n >> a >> b >> c; n *= 2; for (int b0 = (0); b0 <= (b); ++b0) for (int c0 = (0); c0 <= (c); ++c0) { int s = n - 2 * b0 - 4 * c0; if (0 <= s && s <= a) ans++; } cout << ans << endl; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, i, j, cnt = 0; cin >> n >> a >> b >> c; for (i = 0; i <= a; i += 2) { for (j = 0; j <= c; j++) { if (n - (i / 2) - (2 * j) <= b && n - (i / 2) - (2 * j) >= 0) { cnt += 1; } } } cout << cnt << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n, a, b, c; cin >> n >> a >> b >> c; n *= 2; int cnt = 0; for (int i = 0; i <= a; i++) for (int j = 0; j <= b; j++) { int need = n - i - 2 * j; if (need >= 0 && need % 4 == 0 && need / 4 <= c) cnt++; } cout << cnt << "\n"; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, i, j, r = 0, t; cin >> n >> a >> b >> c; n *= 2; for (i = 0; i <= c; i++) { for (j = 0; j <= b; j++) { t = n - 4 * i - 2 * j; if (t < 0) break; if (t <= a) r++; } } cout << r; }
#include <bits/stdc++.h> using namespace std; int l, r; int win; int min1(int a, int b) { return a > b ? b : a; } int main() { int n; int a, b, c, i, j, k, m, t; while (scanf("%d%d%d%d", &n, &a, &b, &c) != EOF) { n = (n << 1); int sum = 0, hold; for (i = 0; i <= b; i++) { for (j = 0; j <= c; j++) { if ((i * 2) + (j * 4) <= n) { hold = n - 2 * i - 4 * j; if (hold >= 0 && hold <= a) { sum++; } } } } printf("%d\n", sum); } }
#include <bits/stdc++.h> using namespace std; int N, A, B, C; int main() { cin.tie(0); cin.sync_with_stdio(0); cin >> N >> A >> B >> C; int ans = 0; for (int a = 0; a <= A; a++) { for (int b = 0; b <= B; b++) { int rem = 2 * N - a - 2 * b; if (rem >= 0 && rem % 4 == 0 && C * 4 >= rem) { ans++; } } } cout << ans; }
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, n, ans = 0, za; cin >> n >> c >> a >> b; for (int i = 0; i <= a; i++) for (int j = 0; j <= b; j++) if (n - (i + j * 2) >= 0) { za = n - (i + j * 2); if (za <= c * 0.5) { ans++; } } cout << ans; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, ans = 0; cin >> n >> a >> b >> c; for (int i = 0; i <= a; ++i) { if (i / 2 > n) break; for (int j = 0; j <= b; ++j) { if (j > n - i / 2) break; if (i % 2 == 0 && (n - i / 2 - j) % 2 == 0 && (n - i / 2 - j) / 2 <= c) ++ans; } } cout << ans; return 0; }
#include <bits/stdc++.h> int main() { int n = 0, a = 0, b = 0, c = 0; scanf("%d%d%d%d", &n, &a, &b, &c); int ans = 0; for (int i = 0; i <= a; i += 2) { for (int j = 0; j <= b; ++j) { int k = n - i / 2 - j; if (0 <= k && k % 2 == 0 && k / 2 <= c) { ++ans; } } } printf("%d\n", ans); return 0; }
#include <bits/stdc++.h> using namespace std; long long ans = 0, n, b, c, i, j, x, y; int main() { scanf("%lld%lld%lld%lld", &n, &x, &y, &c); b = x / 2 + y; for (i = 0; i <= b; i++) for (j = 0; j <= c; j++) if (i + j * 2 == n) { if (j * 2 == n) { ans++; continue; } if (max(x / 2, y) >= i) ans += min(i + 1, min(x / 2, y) + 1); else ans += min(x / 2, y) - (i - max(x / 2, y)) + 1; } printf("%lld\n", ans); return 0; }
#include <bits/stdc++.h> using namespace std; int main(int argc, char* argv[]) { int n, a, b, c, nn, cnt = 0; int i, j, maxb, maxc; cin >> n >> a >> b >> c; maxc = min(c, n / 2); for (i = 0; i <= maxc; i++) { maxb = min(b, (n - i * 2)); for (j = 0; j <= maxb; j++) { nn = i * 2 + j; if (((n - nn) * 2 <= a)) cnt++; } } cout << cnt << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c, ans = 0; cin >> n >> a >> b >> c; for (int i = 0; i <= c; i++) { for (int j = 0; j <= min(n - i * 2, b); j++) { int k = (n - i * 2 - j) * 2; if (k > a) continue; ans++; } } return cout << ans << endl, 0; }
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int k = 0; long double n, a, b, c, i, j, m; cin >> n >> a >> b >> c; for (i = 0; i <= a; i++) { for (j = 0; j <= c; j++) { m = n - (i / 2) - (2 * j); if (m >= 0 and m <= b and floor(m) == m) { k++; } } } cout << k; }
#include <bits/stdc++.h> int min(int x, int y) { if (x < y) return x; else return y; } int main() { int n, ans(0), a, b, c; scanf("%d%d%d%d", &n, &a, &b, &c); n *= 2; for (int z = 0; z <= c; ++z) for (int y = min((n - z * 4) / 2, b); y >= 0; --y) { int x = n - z * 4 - y * 2; if (x > a) break; if (x >= 0) ++ans; } printf("%d\n", ans); return 0; }
#include <bits/stdc++.h> using namespace std; int n, a, b, c; int main() { scanf("%d%d%d%d", &n, &a, &b, &c); long long int ans = 0; for (int i = 0; i <= c; i++) { int rem = n - i * 2; if (rem < 0) break; if (rem > b + a / 2) continue; int lo = max(0, rem - a / 2); int hi = min(b, rem); ans += max(0, hi - lo + 1); } printf("%I64d\n", ans); return 0; }
#include <bits/stdc++.h> int main() { int n, a, b, c, num, tt, i, j; while (scanf("%d %d %d %d", &n, &a, &b, &c) != EOF) { num = 0; for (i = 0; i <= a; i++) { for (j = 0; j <= b; j++) { tt = 2 * n - (i + 2 * j); if (tt % 4 == 0 && tt >= 0 && tt <= 4 * c) num++; } } printf("%d\n", num); } }
#include <bits/stdc++.h> using namespace std; long long f[4][20001]; int n; int a[3], b[3]; int main() { scanf("%d%d%d%d", &n, &a[0], &a[1], &a[2]); n *= 2; b[0] = 1; b[1] = 2; b[2] = 4; f[0][0] = 1; for (int i = 0; i <= 2; i++) for (int j = 0; j <= n; j++) if (f[i][j] > 0) { int u = j; for (int k = 0; k <= a[i]; k++) { f[i + 1][u] += f[i][j]; u += b[i]; if (u > n) { break; } } } cout << f[3][n] << endl; return 0; }
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b, c; cin >> n >> a >> b >> c; int h = 0, o = 0, t = 0, f = t * 2 + o + h / 2; while (f < n) { if (t + 1 <= c && n - f >= 2) { t++; } else if (o + 1 <= b && n - f >= 1) { o++; } else if (h + 2 <= a && n - f >= 1) { h += 2; } else { cout << 0 << '\n'; return 0; } f = t * 2 + o + h / 2; if (t == c && o == b && h == a && f < n) { cout << 0 << "\n"; return 0; } } int sum = 0, th = h, to = o; for (int i = t; i >= 0; i--) { sum++; while (a - th >= 2 && to > 0) { to--; th += 2; sum++; } if (i > 0 && (b + (a / 2) + (i - 1) * 2 >= n)) { int temh = 0, temo = 0, te = (i - 1) * 2 + temo + temh / 2; while (te < n) { if (temo + 1 <= b && n - te >= 1) { temo++; } else if (temh + 2 <= a && n - te >= 1) { temh += 2; } else { cout << sum << '\n'; return 0; } te = (i - 1) * 2 + temo + temh / 2; } th = temh; to = temo; } else { break; } } cout << sum << '\n'; return 0; }
#include <bits/stdc++.h> using namespace std; int mas[10001]; int main() { int n, a, b, c, kol = 0; cin >> n >> a >> b >> c; for (int i = 0; i <= a; i += 2) for (int j = 0; j <= b; j++) { int p = i / 2; mas[p + j]++; } for (int i = 0; i <= c; i++) if (2 * i <= n) kol += mas[n - 2 * i]; else i = c + 1; cout << kol; return 0; }
#include <bits/stdc++.h> using namespace std; int main(int argc, const char* argv[]) { ios::sync_with_stdio(0); cin.tie(0); double a, b, c; long long n, ans = 0, t; cin >> n >> a >> b >> c; for (int i = 0; i <= a; i++) for (int k = 0; k <= b; k++) { double sum = n - 0.5 * i - k; if (sum >= 0) { t = sum; if (!(sum > t)) { if ((t & 1) == 0) { t = t >> 1; if (t <= c) ans += 1; } } } } cout << ans; return 0; }