Codeforces Round #313 (Div. 2) ABC

A

http://codeforces.com/contest/560/problem/A

推断给出的数能否组成全部自然数。

水题


int a[1010];
bool b[1000010]; int main()
{
int n;
while (scanf("%d", &n) != EOF)
{
memset(b,false,sizeof(b));
for (int i = 1; i <= n; i++)
{
scanf("%d", &a[i]);
b[a[i]] = true;
}
int ans = 0;
if (b[1] == false) ans = 1;
else if (b[1]) ans = -1; printf("%d\n",ans);
}
return 0;
}

B

http://codeforces.com/contest/560/problem/B

推断一个矩形能否装下另外两个矩形


int a1, a2, a3, b1, b2, b3; int main()
{
while (scanf("%d%d%d%d%d%d", &a1, &b1, &a2, &b2, &a3, &b3) != EOF)
{
int ok = 0; int t1 = max(b2, b3);
int r1 = max(a2, a3); if ((t1 <= a1 && (a2 + a3) <= b1)) ok = 1;
if ((t1 <= b1 && (a2 + a3) <= a1)) ok = 1;
if ((r1 <= a1 && (b2 + b3) <= b1)) ok = 1;
if ((r1 <= b1 && (b2 + b3) <= a1)) ok = 1; int t11 = max(b2, a3);
int r11 = max(a2, b3); if ((r11 <= a1 && (b2 + a3) <= b1)) ok = 1;
if ((r11 <= b1 && (b2 + a3) <= a1)) ok = 1;
if ((t11 <= a1 && (a2 + b3) <= b1)) ok = 1;
if ((t11 <= b1 && (a2 + b3) <= a1)) ok = 1; if (ok) puts("YES");
else puts("NO");
}
return 0;
}

C

http://codeforces.com/contest/560/problem/C

推断组成六边形须要的三角形个数

int a, b, c, d, e, f;

int main()
{
while (scanf("%d%d%d%d%d%d", &a, &b, &c, &d, &e, &f) != EOF)
{
printf("%d\n", (a + b + c)*(a + b + c) - (a*a + c*c + e*e));
}
return 0;
}
上一篇:Codeforces Round #366 Div.2[11110]


下一篇:Codeforces Round #262 (Div. 2)