# Codeforces Round #292 (Div. 2)

A

 1 #include<iostream>
2 #include<cstdio>
3 #include<cstring>
4 #include<algorithm>
5 using namespace std;
6 int main()
7 {
8     int a,b,s;
9     scanf("%d %d %d",&a,&b,&s);
10     if(a<0) a=-a;
11     if(b<0) b=-b;
12 //    printf("a=%d\n",a);
13
14 //    printf("b=%d\n",b);
15
16     int k=s-a-b;
17
18 //    printf("%d\n",k);
19     if(a==0&&b==0)
20     {
21         if(s%2==0)
22         printf("Yes\n");
23         else
24         printf("No\n");
25     }
26     else
27     {
28         if(k%2==0&&k>=0)
29         printf("Yes\n");
30         else
31         printf("No\n");
32     }
33 }
View Code

B

 1 #include<iostream>
2 #include<cstdio>
3 #include<cstring>
4 #include<algorithm>
5 using namespace std;
6 int x[1005],y[1005];
7 int n,m;
8 int main()
9 {
10     int i,j,b,g,u,flag=0,sum=0;
11     scanf("%d %d",&n,&m);
12     scanf("%d",&b);
13     for(i=1;i<=b;i++)
14     {
15         scanf("%d",&u);
16         x[u]=1;
17     }
18     scanf("%d",&g);
19     for(i=1;i<=g;i++)
20     {
21         scanf("%d",&u);
22         y[u]=1;
23     }
24
25     for(i=0;i<100000;i++)
26     {
27         sum=0;
28         if(x[i%n]||y[i%m])
29         {
30             x[i%n]=1;
31             y[i%m]=1;
32         }
33
34         for( j=0;j<n;j++)
35         sum+=x[j];
36         for(j=0;j<m;j++ )
37         sum+=y[j];
38         if(sum==(n+m))
39         {
40             flag=1;
41             break;
42         }
43
44     }
45     if(flag) printf("Yes\n");
46     else printf("No\n");
47 }
View Code

C

 1 #include<iostream>
2 #include<cstdio>
3 #include<cstring>
4 #include<algorithm>
5 using namespace std;
6 int ss[100005];
7 char str[20];
8 int s[10][5]={{0},{0},{2},{3},{3,2,2},{5},{5,3},{7},{7,2,2,2},{7,3,3,2}};
9 int cmp(int a,int b)
10 {
11     return a>b;
12 }
13 int main()
14 {
15     int  n,i,j,k=0;
16     scanf("%d",&n);
17     scanf("%s",&str);
18     for(i=0;i<n;i++)
19     {
20         int a=str[i]-'0';
21         for(j=0;s[a][j]!=0;j++)
22         {
23             ss[k]=s[a][j];
24             k++;
25         }
26     }
27     sort(ss,ss+k,cmp);
28     for(i=0;i<k;i++)
29     printf("%d",ss[i]);
30     printf("\n");
31 }
View Code

posted @ 2015-02-18 18:52  sequenceaa  阅读(125)  评论(0编辑  收藏  举报