#include <stdio.h>
#include <string.h>
int main(void) {
char strc[12][3] = {"黒", "茶", "赤", "橙", "黄", "緑", "青", "紫", "灰", "白", "金", "銀"};
char instr[10][3];
int bai[12] = {0, 1, 2, 3, 4, 5, 6, 7, 0, -3, -1, -2};
double pre[12] = {0, 1, 2, 0.05, 0, 0.5, 0.25, 0.1, 0, 0, 5, 10};
int i, j, k, b, p;
int C[5];
for (i = 0; i <= 2; i++) {
for (j = 0; j <= 11; j++) {
for (k = 0; k <= 2; k++) {
if (!(instr[i][k] == strc[j][k])) {
goto A1;
}
}
C[i] = j;
A1:;
}
}
i = 3;
for (j = 0; j <= 11; j++) {
for (k = 0; k <= 2; k++) {
if (!(instr[i][k] == strc[j][k])) {
goto A2;
}
}
b = j;
A2:;
}
i = 4;
for (j = 0; j <= 11; j++) {
for (k = 0; k <= 2; k++) {
if (!(instr[i][k] == strc[j][k])) {
goto A3;
}
}
p = j;
A3:;
}
printf("%d %d %d %d\n", C
[0], C
[1], b
, p
); printf("抵抗値=%d×10^(%d)[Ω] 精度=%.2f[%%]\n", 100 * C
[0] + 10 * C
[1] + C
[2], bai
[b
], pre
[p
]);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KIAppbnQgbWFpbih2b2lkKSB7CiAgICBjaGFyIHN0cmNbMTJdWzNdID0geyLpu5IiLCAi6Iy2IiwgIui1pCIsICLmqZkiLCAi6buEIiwgIue3kSIsICLpnZIiLCAi57SrIiwgIueBsCIsICLnmb0iLCAi6YeRIiwgIumKgCJ9OwogICAgY2hhciBpbnN0clsxMF1bM107ICAKICAgIGludCBiYWlbMTJdID0gezAsIDEsIDIsIDMsIDQsIDUsIDYsIDcsIDAsIC0zLCAtMSwgLTJ9OwogICAgZG91YmxlIHByZVsxMl0gPSB7MCwgMSwgMiwgMC4wNSwgMCwgMC41LCAwLjI1LCAwLjEsIDAsIDAsIDUsIDEwfTsgCiAgICBpbnQgaSwgaiwgaywgYiwgcDsKICAgIGludCBDWzVdOyAgCiAKICAgIHN0cmNweShpbnN0clswXSwgIue0qyIpOyAgCiAgICBzdHJjcHkoaW5zdHJbMV0sICLpu4QiKTsgIAogICAgc3RyY3B5KGluc3RyWzJdLCAi5qmZIik7ICAKICAgIHN0cmNweShpbnN0clszXSwgIui1pCIpOyAgCiAgICBzdHJjcHkoaW5zdHJbNF0sICLojLYiKTsgIAogCiAgICBmb3IgKGkgPSAwOyBpIDw9IDI7IGkrKykgewogICAgICAgIGZvciAoaiA9IDA7IGogPD0gMTE7IGorKykgewogICAgICAgICAgICBmb3IgKGsgPSAwOyBrIDw9IDI7IGsrKykgewogICAgICAgICAgICAgICAgaWYgKCEoaW5zdHJbaV1ba10gPT0gc3RyY1tqXVtrXSkpIHsKICAgICAgICAgICAgICAgICAgICBnb3RvIEExOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICB9CiAgICAgICAgICAgIENbaV0gPSBqOwogICAgICAgICAgICBBMTo7CiAgICAgICAgfQogICAgfQogCiAgICBpID0gMzsKICAgIGZvciAoaiA9IDA7IGogPD0gMTE7IGorKykgewogICAgICAgIGZvciAoayA9IDA7IGsgPD0gMjsgaysrKSB7CiAgICAgICAgICAgIGlmICghKGluc3RyW2ldW2tdID09IHN0cmNbal1ba10pKSB7CiAgICAgICAgICAgICAgICBnb3RvIEEyOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGIgPSBqOwogICAgICAgIEEyOjsKICAgIH0KIAogICAgaSA9IDQ7CiAgICBmb3IgKGogPSAwOyBqIDw9IDExOyBqKyspIHsKICAgICAgICBmb3IgKGsgPSAwOyBrIDw9IDI7IGsrKykgewogICAgICAgICAgICBpZiAoIShpbnN0cltpXVtrXSA9PSBzdHJjW2pdW2tdKSkgewogICAgICAgICAgICAgICAgZ290byBBMzsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBwID0gajsKICAgICAgICBBMzo7CiAgICB9CiAKICAgIHByaW50ZigiJWQgJWQgJWQgJWRcbiIsIENbMF0sIENbMV0sIGIsIHApOwogICAgcHJpbnRmKCLmirXmipflgKQ9JWTDlzEwXiglZClbzqldICDnsr7luqY9JS4yZlslJV1cbiIsIDEwMCAqIENbMF0gKyAxMCAqIENbMV0gKyBDWzJdLCBiYWlbYl0sIHByZVtwXSk7CiAKICAgIHJldHVybiAwOwp9CiA=