Sun, 17 Nov 2019 10:43:38 +0800
parent
a3c173db6f
commit
bfbb7fce99
@ -1,15 +0,0 @@
|
|||||||
#include <algorithm>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstring>
|
|
||||||
using namespace std;
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
int n, k;
|
|
||||||
scanf("%d%d", &n, &k);
|
|
||||||
int ans = 0;
|
|
||||||
ans += (n * 2 + k - 1) / k;
|
|
||||||
ans += (n * 5 + k - 1) / k;
|
|
||||||
ans += (n * 8 + k - 1) / k;
|
|
||||||
printf("%d", ans);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
#include <algorithm>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstring>
|
|
||||||
using namespace std;
|
|
||||||
int presum(int x)
|
|
||||||
{
|
|
||||||
return (x >> 1) - x * (x & 1);
|
|
||||||
}
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
int q, l, r;
|
|
||||||
scanf("%d", &q);
|
|
||||||
while (q--)
|
|
||||||
{
|
|
||||||
scanf("%d%d", &l, &r);
|
|
||||||
printf("%d\n", presum(r) - presum(l - 1));
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
#include <algorithm>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstring>
|
|
||||||
#include <utility>
|
|
||||||
using namespace std;
|
|
||||||
typedef long long ll;
|
|
||||||
pair<ll, ll> bwcount(ll x1, ll y1, ll x2, ll y2)
|
|
||||||
{
|
|
||||||
if (x1 > x2 || y1 > y2) return make_pair(0, 0);
|
|
||||||
ll sum = (y2 - y1 + 1) * (x2 - x1 + 1);
|
|
||||||
ll c1 = (x2 - x1 + 1) >> 1, c2 = (x2 - x1 + 2) >> 1;
|
|
||||||
ll h = (y2 - y1 + 1) >> 1;
|
|
||||||
ll bcnt = h * (c1 + c2) + ((y2 - y1 + 1) & 1) * (((x1 + y1) & 1) ? c2 : c1);
|
|
||||||
return make_pair(bcnt, sum - bcnt);
|
|
||||||
}
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
while (false)
|
|
||||||
{
|
|
||||||
int x1, y1, x2, y2;
|
|
||||||
scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
|
|
||||||
auto ans = bwcount(x1, y1, x2, y2);
|
|
||||||
printf("%lld %lld\n", ans.first, ans.second);
|
|
||||||
}
|
|
||||||
ll T, n, m, x1, y1, x2, y2, x3, y3, x4, y4;
|
|
||||||
scanf("%lld", &T);
|
|
||||||
while (T--)
|
|
||||||
{
|
|
||||||
scanf("%lld%lld%lld%lld%lld%lld%lld%lld%lld%lld",
|
|
||||||
&n, &m, &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
|
|
||||||
ll sum = n * m;
|
|
||||||
ll wsum = (x2 - x1 + 1) * (y2 - y1 + 1);
|
|
||||||
ll bsum = (x4 - x3 + 1) * (y4 - y3 + 1);
|
|
||||||
auto org = bwcount(1, 1, m, n);
|
|
||||||
auto dif1 = bwcount(x1, y1, x2, y2);
|
|
||||||
auto dif2 = bwcount(x3, y3, x4, y4);
|
|
||||||
auto dif3 = bwcount(max(x1, x3), max(y1, y3), min(x2, x4), min(y2, y4));
|
|
||||||
org.first = org.first - dif1.first - dif2.first + dif3.first;
|
|
||||||
org.second = org.second - dif1.second - dif2.second + dif3.second;
|
|
||||||
org.first += bsum, org.second += wsum;
|
|
||||||
ll crs = dif3.first + dif3.second;
|
|
||||||
org.second -= crs;
|
|
||||||
printf("%lld %lld\n", org.second, org.first);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
#include <algorithm>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstring>
|
|
||||||
using namespace std;
|
|
||||||
typedef long long ll;
|
|
||||||
ll K[100010], N[100010];
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
for (int i = 1; i < 100; i++)
|
|
||||||
K[i] = K[i - 1] + (1ll << (i - 1)) - 1;
|
|
||||||
for (int i = 1; i < 100; i++)
|
|
||||||
N[i] = (N[i - 1] << 2) + 1;
|
|
||||||
ll T, n, k;
|
|
||||||
scanf("%lld", &T);
|
|
||||||
while (T--)
|
|
||||||
{
|
|
||||||
scanf("%lld%lld", &n, &k);
|
|
||||||
if (k > N[n])
|
|
||||||
puts("NO");
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = 1; i < 100; i++)
|
|
||||||
{
|
|
||||||
if (K[i - 1] >= k)
|
|
||||||
{
|
|
||||||
printf("YES %lld\n", n - i + 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
#include <algorithm>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <cstring>
|
|
||||||
using namespace std;
|
|
||||||
typedef long long ll;
|
|
||||||
ll K[100010];
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
K[0] = 0;
|
|
||||||
for (int i = 1; i < 100; i++)
|
|
||||||
K[i] = K[i - 1] + (1 << (i - 1)) - 1;
|
|
||||||
ll T, n, k;
|
|
||||||
scanf("%lld", &T);
|
|
||||||
while (T--)
|
|
||||||
{
|
|
||||||
scanf("%lld", &n, &k);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
add_executable(1 1.cpp)
|
|
||||||
add_executable(2 2.cpp)
|
|
||||||
add_executable(3 3.cpp)
|
|
||||||
add_executable(4 4.cpp)
|
|
||||||
add_executable(5 5.cpp)
|
|
||||||
Loading…
Reference in new issue