MemSQL Start[c]UP 2.0 - Round 1

來源:互聯網
上載者:User

標籤:style   blog   http   color   os   io   for   art   

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

 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.