Codeforce Round #228 Div2 B
→ Practice
You are registered for practice. You can solve problems unofficially. Results can be found in the contest status and in the bottom of standings.
1 #pragma comment(linker,"/STACK:102400000,102400000") 2 #include <cstdio> 3 #include <vector> 4 #include <cmath> 5 #include <queue> 6 #include <set> 7 #include <cstring> 8 #include <iostream> 9 #include <algorithm> 10 using namespace std; 11 #define INF 0x7fffffff 12 #define mod 1000000007 13 #define ll long long 14 #define maxn 1000005 15 #define pi acos(-1.0) 16 #define dis(a, b) sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y)) 17 ll gcd(ll n, ll m){ return m ? gcd(m, n%m) : n; } 18 ll n, m, k, x, y; 19 struct node{int a, b;}p[maxn]; 20 bool cmp(node a, node b){ return (a.a < b.a || a.a == b.a&&a.b < b.b); } 21 ll a[maxn], b[maxn], c[maxn]; 22 int main(){ 23 cin >> n; 24 for (int i = 0; i < n; i++)scanf("%I64d", &a[i]); 25 for (int i = 0; i < n; i++)scanf("%I64d", &b[i]); 26 for (int i = 0; i < n; i++){ 27 if (b[i] == 1){ x--; continue; } 28 if (b[i] % 2 == 0 && a[i] >= b[i] / 2)x += b[i] * b[i] / 4; 29 if (b[i] % 2 == 0 && a[i] < b[i] / 2)x--; 30 if (b[i] % 2 == 1 && a[i] > b[i] / 2)x += b[i] / 2 * (b[i] / 2 + 1); 31 if (b[i] % 2 == 1 && a[i] <= b[i] / 2)x--; 32 } 33 cout << x << endl; 34 return 0; 35 }




浙公网安备 33010602011771号