4452 類比水題,4452類比水題

來源:互聯網
上載者:User

4452 類比水題,4452類比水題

#include<stdio.h>#include<string.h>#include<iostream>using namespace std;int abs(int a){    return a>0?a:(-a+1);}int main(){    int n,i,j,s1,t1,s2,t2,m;    char first[5],second[5];    while(~scanf("%d",&n),n)    {        scanf("%s",first);        scanf("%d%d",&s1,&t1);        scanf("%s%d%d",second,&s2,&t2);        scanf("%d",&m);        int fx=1,fy=1,sx=n,sy=n;        for(i=1;i<=m;i++)        {            if(first[0]=='W')            {                if(fy-1<s1)                {                    fy=s1-fy+2;                    first[0]='E';                }                else fy-=s1;            }             else if(first[0]=='E')            {                if(n-fy<s1)                {                    fy=2*n-s1-fy;                    first[0]='W';                }                else fy+=s1;            }            else if(first[0]=='N')            {                if(fx-1<s1)                {                    fx=s1-fx+2;                    first[0]='S';                }                else fx-=s1;            }                      else            {                if(n-fx<s1)                {                    fx=2*n-s1-fx;                    first[0]='N';                }                else fx+=s1;            }            if(second[0]=='W')            {                if(sy-1<s2)                {                    sy=s2-sy+2;                    second[0]='E';                }                else sy-=s2;            }             else if(second[0]=='E')            {                if(n-sy<s2)                {                    sy=2*n-s2-sy;                    second[0]='W';                }                else sy+=s2;            }            else if(second[0]=='N')            {                if(sx-1<s2)                {                    sx=s2-sx+2;                    second[0]='S';                }                else sx-=s2;            }                      else            {                if(n-sx<s2)                {                    sx=2*n-s2-sx;                    second[0]='N';                }                else sx+=s2;            }            if(fx==sx&&fy==sy)            {                char p=first[0];                first[0]=second[0];                second[0]=p;            }            else            {                if(i%t1==0)                {                    if(first[0]=='W') first[0]='S';                    else if(first[0]=='E') first[0]='N';                    else if(first[0]=='N') first[0]='W';                    else first[0]='E';                }                if(i%t2==0)                {                    if(second[0]=='W') second[0]='S';                    else if(second[0]=='E') second[0]='N';                    else if(second[0]=='N') second[0]='W';                    else second[0]='E';                }            }        }        printf("%d %d\n",fx,fy);        printf("%d %d\n",sx,sy);    }    return 0;}

poj基礎水題

1004,求十二個數的平均數
2027,求是否滿足A>=B
3030
3062這兩個也傳說超水,暫時懶得去看。
1656,這個本來應該是不水的,估計題意原來是讓用線段樹或者樹狀數組做的,但是,題目裡的資料規模太小了,直接類比就過了。。也就成超級水題了。
先把這幾個A了吧。特別前幾個題難度可以和A+B齊名了。。
 
noip2010提高組複賽第一題(被大牛們稱為水題)不會做

類比法就可以了,開個數組,在紙上寫寫畫畫,找個簡單的規律,就可以了
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.