bzoj 1022 2467 3505 4001
parent
cd47224b1d
commit
a14b396aed
@ -0,0 +1,21 @@
|
||||
//http://wenku.baidu.com/link?url=hdO-izu3ggfWlLUkg9YTHcU28Z1TDzVHtXzDSDnDl4yVyTMjcA3i1qb9BNbJMVbSRm2q9D5MpN12DQNX_N1J4NJhb2larJdiw7-o8Ki9Hqa
|
||||
#include <cstdio>
|
||||
int main()
|
||||
{
|
||||
int T, n, x;
|
||||
scanf("%d", &T);
|
||||
while (T--)
|
||||
{
|
||||
scanf("%d", &n);
|
||||
int ans = 0, f = 1;
|
||||
while (n--)
|
||||
{
|
||||
scanf("%d", &x);
|
||||
ans ^= x;
|
||||
if (x != 1) f = 0;
|
||||
}
|
||||
ans = ans ? 1 : 0;
|
||||
puts(f ^ ans ? "John" : "Brother");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
//http://blog.csdn.net/popoqqq/article/details/41348131
|
||||
#include <cstdio>
|
||||
const int mod = 2007;
|
||||
int fast_pow(int base, int p)
|
||||
{
|
||||
int ans = 1;
|
||||
for (base %= mod; p; base = base * base % mod, p >>= 1)
|
||||
if (p & 1)
|
||||
ans = ans * base % mod;
|
||||
return ans;
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int t, x;
|
||||
scanf("%d", &t);
|
||||
while (t--)
|
||||
{
|
||||
scanf("%d", &x);
|
||||
printf("%d\n", 4 * x % mod * fast_pow(5, x - 1) % mod);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
//http://blog.csdn.net/popoqqq/article/details/39779647
|
||||
#include <cstdio>
|
||||
int gcd(int x, int y) { return y == 0 ? x : gcd(y, x % y); }
|
||||
int main()
|
||||
{
|
||||
int m, n;
|
||||
scanf("%d%d", &m, &n);
|
||||
m++, n++;
|
||||
long long ans = m * n;
|
||||
ans = ans * (ans - 1) * (ans - 2) / 6;
|
||||
for (int i = 0; i <= m; i++)
|
||||
for (int j = 0; j <= n; j++)
|
||||
if (i || j)
|
||||
ans -= (i && j ? 2ll : 1ll) * (gcd(i, j) - 1) * (m - i) * (n - j);
|
||||
printf("%lld", ans);
|
||||
return 0;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
//http://blog.miskcoo.com/2015/04/bzoj-4001
|
||||
#include <cstdio>
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
scanf("%d", &n);
|
||||
printf("%.9lf", 1.0 * n * (n + 1) / 2 / (n * 2 - 1));
|
||||
return 0;
|
||||
}
|
||||
Loading…
Reference in new issue