#include <stdio.h>
int main(void) {
char strc[12][3] = {"黒", "茶", "赤", "橙", "黄", "緑", "青", "紫", "灰", "白", "金", "銀"};
char instr[5][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 < 5; i++) {
}
for (i = 0; i < 5; i++) {
}
for (i = 0; i <= 2; i++) {
for (j = 0; j <= 9; 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:;
}
i = 4;
int error_rate_index = -1;
for (j = 0; j <= 11; j++) {
for (k = 0; k <= 2; k++) {
if (!(instr[i][k] == strc[j][k])) {
goto A4;
}
}
error_rate_index = j;
A4:;
}
printf("%d %d %d %d\n", C
[0], C
[1], b
, p
); printf("抵抗値=%d×10^(%d)[Ω] 精度=%.2f[%%] 誤差率=%d[%%]\n", 10 * C[0] + C[1], bai[b], pre[p], bai[error_rate_index]);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7CiAgICBjaGFyIHN0cmNbMTJdWzNdID0geyLpu5IiLCAi6Iy2IiwgIui1pCIsICLmqZkiLCAi6buEIiwgIue3kSIsICLpnZIiLCAi57SrIiwgIueBsCIsICLnmb0iLCAi6YeRIiwgIumKgCJ9OwogICAgY2hhciBpbnN0cls1XVszXTsgCiAgICBpbnQgYmFpWzEyXSA9IHswLCAxLCAyLCAzLCA0LCA1LCA2LCA3LCAwLCAtMywgLTEsIC0yfTsKICAgIGRvdWJsZSBwcmVbMTJdID0gezAsIDEsIDIsIDAuMDUsIDAsIDAuNSwgMC4yNSwgMC4xLCAwLCAwLCA1LCAxMH07CiAgICBpbnQgaSwgaiwgaywgYiwgcDsKICAgIGludCBDWzRdOwoKICAgIHByaW50Zigi44Kr44Op44O844Kz44O844OJ44KSNeOBpDogIik7CiAgICBmb3IgKGkgPSAwOyBpIDwgNTsgaSsrKSB7CiAgICAgICAgc2NhbmYoIiVzIiwgaW5zdHJbaV0pOwogICAgfQogICAgZm9yIChpID0gMDsgaSA8IDU7IGkrKykgewogICAgICAgIHByaW50ZigiJXMgIiwgaW5zdHJbaV0pOwogICAgfQogICAgcHJpbnRmKCJcbiIpOwoKICAgIGZvciAoaSA9IDA7IGkgPD0gMjsgaSsrKSB7CiAgICAgICAgZm9yIChqID0gMDsgaiA8PSA5OyBqKyspIHsKICAgICAgICAgICAgZm9yIChrID0gMDsgayA8PSAyOyBrKyspIHsKICAgICAgICAgICAgICAgIGlmICghKGluc3RyW2ldW2tdID09IHN0cmNbal1ba10pKSB7CiAgICAgICAgICAgICAgICAgICAgZ290byBBMTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICBDW2ldID0gajsKICAgICAgICAgICAgQTE6OwogICAgICAgIH0KICAgIH0KCiAgICBpID0gMjsKICAgIGZvciAoaiA9IDA7IGogPD0gMTE7IGorKykgewogICAgICAgIGZvciAoayA9IDA7IGsgPD0gMjsgaysrKSB7CiAgICAgICAgICAgIGlmICghKGluc3RyW2ldW2tdID09IHN0cmNbal1ba10pKSB7CiAgICAgICAgICAgICAgICBnb3RvIEEyOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGIgPSBqOwogICAgICAgIEEyOjsKICAgIH0KCiAgICBpID0gMzsKICAgIGZvciAoaiA9IDA7IGogPD0gMTE7IGorKykgewogICAgICAgIGZvciAoayA9IDA7IGsgPD0gMjsgaysrKSB7CiAgICAgICAgICAgIGlmICghKGluc3RyW2ldW2tdID09IHN0cmNbal1ba10pKSB7CiAgICAgICAgICAgICAgICBnb3RvIEEzOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIHAgPSBqOwogICAgICAgIEEzOjsKICAgIH0KCiAgICBpID0gNDsgCiAgICBpbnQgZXJyb3JfcmF0ZV9pbmRleCA9IC0xOyAKICAgIGZvciAoaiA9IDA7IGogPD0gMTE7IGorKykgewogICAgICAgIGZvciAoayA9IDA7IGsgPD0gMjsgaysrKSB7CiAgICAgICAgICAgIGlmICghKGluc3RyW2ldW2tdID09IHN0cmNbal1ba10pKSB7CiAgICAgICAgICAgICAgICBnb3RvIEE0OwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGVycm9yX3JhdGVfaW5kZXggPSBqOwogICAgICAgIEE0OjsKICAgIH0KCiAgICBwcmludGYoIiVkICVkICVkICVkXG4iLCBDWzBdLCBDWzFdLCBiLCBwKTsKICAgIHByaW50Zigi5oq15oqX5YCkPSVkw5cxMF4oJWQpW86pXSAg57K+5bqmPSUuMmZbJSVdICDoqqTlt67njoc9JWRbJSVdXG4iLAogICAgICAgICAgIDEwICogQ1swXSArIENbMV0sIGJhaVtiXSwgcHJlW3BdLCBiYWlbZXJyb3JfcmF0ZV9pbmRleF0pOwoKICAgIHJldHVybiAwOwp9