相似颜色

#pragma comment(linker, "/STACK:102400000,102400000")
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<vector>
#include<algorithm>
#include<iostream>
#include<map>
#include<queue>
#include<stack>
#include<string>
#include<functional>
#include<math.h>
//#include<bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef queue<int> QI;


void makedata() {
    freopen("input.txt", "w", stdout);
    fclose(stdout);
}



int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
#endif
    //makedata();
    std::ios::sync_with_stdio(0), cin.tie(0);
    char ch[10];
    int a[10];
    scanf("%s", ch);
    for (int i = 1; i <= 6; i++) {
        if ('0' <= ch[i] && ch[i] <= '9') a[i] = ch[i] - '0';
        else a[i] = ch[i] - 'a' + 10;
    }
    printf("#");
    for (int i = 1; i <= 3; i++) {
        int x = a[i * 2 - 1] * 16 + a[i * 2];
        x = (x + 8) / 17;
        if (x < 10) printf("%d", x);
        else printf("%c", x - 10 + 'a');
    }
    return 0;
}
View Code

相关文章: