MemSQL Start[c]UP 2.0 - Round 1

A. Eevee http://codeforces.com/contest/452/problem/A

字符串水题

 1 #include<cstdio>
 2 #include<cstring>
 3 using namespace std;
 4 const int M=16;
 5 char a[16][M]={"vaporeon", "jolteon", "flareon", "espeon", "umbreon", "leafeon", "glaceon", "sylveon"};
 6 char b[M];
 7 int main(){
 8     int n;
 9     while(~scanf("%d",&n)){
10         scanf("%s",b);
11         for(int i=0;i<8;i++){
12             int la=strlen(a[i]);
13             if(la==n){
14                 bool flag=true;
15                 for(int j=0;j<n;j++){
16                     if(b[j]!='.'&&b[j]!=a[i][j]){
17                         flag=false;
18                         break;
19                     }
20                 }
21                 if(flag){
22                     puts(a[i]);
23                     break;
24                 }
25             }
26         }
27     }
28     return 0;
29 }
View Code

 B. 4-point polyline http://codeforces.com/contest/452/problem/B

暴力几种画法

 1 #include<cstdio>
 2 #include<cstdlib>
 3 #include<cstring>
 4 #include<cmath>
 5 #include<cctype>
 6 #include<iostream>
 7 #include<algorithm>
 8 #include<queue>
 9 #include<stack>
10 #include<vector>
11 #include<map>
12 #include<set>
13 #define mt(a,b) memset(a,b,sizeof(a))
14 using namespace std;
15 typedef __int64 LL;
16 const int inf=0x7fffffff;
17 const int M=100;
18 struct point{
19     int x,y;
20 };
21 struct G{
22     point p[4];
23     int val;
24     friend bool operator <(G a,G b){
25         return a.val>b.val;
26     }
27 }g[M];
28 int dist(point a,point b){
29     return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
30 }
31 int lg;
32 void add(int id,int x,int y){
33     g[lg].p[id].x=x;
34     g[lg].p[id].y=y;
35 }
36 int main(){
37     int n,m;
38     while(~scanf("%d%d",&n,&m)){
39         if(n==0){
40             printf("0 1\n");
41             printf("0 %d\n",m);
42             printf("0 0\n");
43             printf("0 %d\n",m-1);
44             continue;
45         }
46         if(m==0){
47             printf("1 0\n");
48             printf("%d 0\n",n);
49             printf("0 0\n");
50             printf("%d 0\n",n-1);
51             continue;
52         }
53         lg=0;
54         add(0,0,0);
55         add(1,n,m);
56         add(2,0,m);
57         add(3,n,0);
58         lg++;
59         add(0,0,0);
60         add(1,n,m);
61         add(2,n,0);
62         add(3,0,m);
63         lg++;
64         add(0,1,0);
65         add(1,n,m);
66         add(2,0,0);
67         add(3,n-1,m);
68         lg++;
69         add(0,0,1);
70         add(1,n,m);
71         add(2,0,0);
72         add(3,n,m-1);
73         lg++;
74         add(0,1,1);
75         add(1,n,m);
76         add(2,0,0);
77         add(3,n-1,m-1);
78         lg++;
79         for(int i=0;i<lg;i++){
80             g[i].val=0;
81             for(int j=0;j<3;j++){
82                 g[i].val+=dist(g[i].p[j],g[i].p[j+1]);
83             }
84         }
85         sort(g,g+lg);
86         for(int i=0;i<4;i++){
87             printf("%d %d\n",g[0].p[i].x,g[0].p[i].y);
88         }
89     }
90     return 0;
91 }
View Code

 

转载于:https://www.cnblogs.com/gaolzzxin/p/3872544.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值