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提高組複賽第一題(被大牛們稱為水題)不會做
類比法就可以了,開個數組,在紙上寫寫畫畫,找個簡單的規律,就可以了