本文主要是介绍codeforces-Coder-Strike 2014 - Finals (online edition, Div. 2),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
A. Pasha and Hamsters 模拟
#include <stdio.h>
#include <string.h>int l1[101];
int l2[101];int main()
{memset(l1,0,sizeof (l1));memset(l2,0,sizeof (l2));int n,a,b,i,t;scanf ("%d%d%d",&n,&a,&b);for (i = 0;i < a;i++){scanf ("%d",&t);l1[t] = 1;}for (i = 0;i < b;i++){scanf ("%d",&t);l2[t] = 1;}for (i = 1;i <= n;i++){if (l1[i])printf ("1");else if (l2[i])printf ("2");if (i < n)printf (" ");elseprintf ("\n");}return 0;
}
B. Start Up 镜像回文
#include <stdio.h>
#include <string.h>char s[1000000];int zmpd (char c)
{if (c == 'A' || c == 'H' || c == 'I' || c == 'M' || c == 'O' || c == 'T' || c == 'U' || c == 'V' || c == 'W' || c == 'X' || c == 'Y')return 1;return 0;
}int huiwenpd (char s[],int len)
{int m = len / 2;for (int i = 0;i < m;i++)if (s[i] != s[len - i - 1])return 0;return 1;
}int main()
{int tf = 1;scanf ("%s",s);char *p = s;while (*p != '\0'){tf = zmpd (*p);if (!tf)break;p++;}if (tf)tf = huiwenpd(s,strlen (s));if (tf)puts ("YES");elseputs("NO");return 0;
}
这篇关于codeforces-Coder-Strike 2014 - Finals (online edition, Div. 2)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!