/* 1996 ACM North Central Regional Programming Contest Problem A -- It's Ir-Resist-Able Ed Karrels, November 1996 */ #include typedef struct { int a, b; float ohm; } Resistor; Resistor resist[30]; int n_resist, from, to; int Pt2Resist(int pt, int r) { return resist[r].a == pt || resist[r].b == pt; } int InSeries(int r1, int r2) { int x, y; x = Pt2Resist(resist[r1].a, r2); y = Pt2Resist(resist[r1].b, r2); return (x && !y) || (!x && y); } int InParallel(int r1, int r2) { return Pt2Resist(resist[r1].a, r2) && Pt2Resist(resist[r1].b, r2); } int OtherConnected(int pt, int r1, int r2) { int i; for (i=0; i