1. 程式人生 > >計蒜客-Chessboard Dancing(思維題)

計蒜客-Chessboard Dancing(思維題)

不要怕長題! 不要怕長題! 不要怕長題!

90%的長題都很簡單。

這道題其實仔細想一下拿個紙畫一下就可以了,感覺更多的是在考翻譯。

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<math.h>
using namespace std;

int main() {
    int S;
    char ty[5];
    while(scanf("%d%s",&S,ty) != EOF){
        if(*ty == 'R' || *ty == 'B')
            printf("%d\n",S);
        else if(*ty == 'K')
            printf("%d\n",min(4,S*S));
        else
            printf("%d\n",(S<=2 ? 1 : 2));
    }
    return 0;
}