http://codeforces.com/contest/1191

A

给一个数,可以加0,1或2然后取模,再映射到字母,字母有排名,求最大排名。

总共只有4种情况,讨论即可

#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<vector>
#define ll long long
#define fo(i,l,r) for(int i = l;i <= r;i++)
#define fd(i,l,r) for(int i = r;i >= l;i--)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
const int maxn = 400050;
const ll inf = 987654321234500LL;
const ll mod = 1e9+7;
ll n;
ll read() {
    ll x=0,f=1;
    char ch=getchar();
    while(!(ch>='0'&&ch<='9')) {
        if(ch=='-')f=-1;
        ch=getchar();
    };
    while(ch>='0'&&ch<='9') {
        x=x*10+(ch-'0');
        ch=getchar();
    };
    return x*f;
}
int tran[4]={1,4,3,2};
int main() {
    n=read();
    int mx,dd;
    n %= 4;
    if(n==0){
        dd=1;
        mx = 0;
    }
    if(n==1){
        dd = 0;
        mx = 0;
    }
    if(n==2){
        dd = 1;
        mx = 1;
    }
    if(n==3){
        dd = 2;
        mx = 0;
    }
    cout<<dd<<" "<<(char)('A'+mx);
    return 0;
}
View Code

相关文章: