#include <stdio.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[4];
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 = 2;
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 = 3;
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", 10 * C
[0] + C
[1], bai
[b
], pre
[p
]);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7CiAgICBjaGFyIHN0cmNbMTJdWzNdID0geyLpu5IiLCAi6Iy2IiwgIui1pCIsICLmqZkiLCAi6buEIiwgIue3kSIsICLpnZIiLCAi57SrIiwgIueBsCIsICLnmb0iLCAi6YeRIiwgIumKgCJ9OwogICAgY2hhciBpbnN0clsxMF1bM107ICAKICAgIGludCBiYWlbMTJdID0gezAsIDEsIDIsIDMsIDQsIDUsIDYsIDcsIDAsIC0zLCAtMSwgLTJ9OyAgCiAgICBkb3VibGUgcHJlWzEyXSA9IHswLCAxLCAyLCAwLjA1LCAwLCAwLjUsIDAuMjUsIDAuMSwgMCwgMCwgNSwgMTB9OyAKICAgIGludCBpLCBqLCBrLCBiLCBwOwogICAgaW50IENbNF07ICAKCiAgICBzdHJjcHkoaW5zdHJbMF0sICLotaQiKTsgIAogICAgc3RyY3B5KGluc3RyWzFdLCAi6Iy2Iik7ICAKICAgIHN0cmNweShpbnN0clsyXSwgIum7hCIpOyAgCiAgICBzdHJjcHkoaW5zdHJbM10sICLph5EiKTsgIAoKICAgIGZvciAoaSA9IDA7IGkgPD0gMjsgaSsrKSB7CiAgICAgICAgZm9yIChqID0gMDsgaiA8PSAxMTsgaisrKSB7CiAgICAgICAgICAgIGZvciAoayA9IDA7IGsgPD0gMjsgaysrKSB7CiAgICAgICAgICAgICAgICBpZiAoIShpbnN0cltpXVtrXSA9PSBzdHJjW2pdW2tdKSkgewogICAgICAgICAgICAgICAgICAgIGdvdG8gQTE7CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgQ1tpXSA9IGo7CiAgICAgICAgICAgIEExOjsKICAgICAgICB9CiAgICB9CgogICAgaSA9IDI7CiAgICBmb3IgKGogPSAwOyBqIDw9IDExOyBqKyspIHsKICAgICAgICBmb3IgKGsgPSAwOyBrIDw9IDI7IGsrKykgewogICAgICAgICAgICBpZiAoIShpbnN0cltpXVtrXSA9PSBzdHJjW2pdW2tdKSkgewogICAgICAgICAgICAgICAgZ290byBBMjsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBiID0gajsKICAgICAgICBBMjo7CiAgICB9CgogICAgaSA9IDM7CiAgICBmb3IgKGogPSAwOyBqIDw9IDExOyBqKyspIHsKICAgICAgICBmb3IgKGsgPSAwOyBrIDw9IDI7IGsrKykgewogICAgICAgICAgICBpZiAoIShpbnN0cltpXVtrXSA9PSBzdHJjW2pdW2tdKSkgewogICAgICAgICAgICAgICAgZ290byBBMzsKICAgICAgICAgICAgfQogICAgICAgIH0KICAgICAgICBwID0gajsKICAgICAgICBBMzo7CiAgICB9CgogICAgcHJpbnRmKCIlZCAlZCAlZCAlZFxuIiwgQ1swXSwgQ1sxXSwgYiwgcCk7CiAgICBwcmludGYoIuaKteaKl+WApD0lZMOXMTBeKCVkKVvOqV0gIOeyvuW6pj0lLjJmWyUlXVxuIiwgMTAgKiBDWzBdICsgQ1sxXSwgYmFpW2JdLCBwcmVbcF0pOwoKICAgIHJldHVybiAwOwp9