#include #include #include using namespace std; double p[100000]; int main() { int u, uc1, uc2, ut1, ut2; char pr[10]; double h; while(scanf("%d", &u) != EOF) { if (!u) { printf("goodbye\n"); return 0; } for (int i = 0; i < 100000; i++) { p[i] = -1; } for (int i = 0; i < u; i++) { scanf("%d/%d %lf", &uc1, &uc2, &h); p[uc1*10+uc2] = h; } scanf("%s", pr); while(pr[0] != 'e') { if (pr[0] == 'w') { scanf("%d/%d %lf", &uc1, &uc2, &h); printf("withdraw %.2lf: ", h); if (p[uc1*10+uc2] == -1) { printf("no such account\n"); } else if (p[uc1*10+uc2] < h) { printf("insufficient funds\n"); } else { p[uc1*10+uc2] -= h; printf("ok\n"); } } else if (pr[0] == 'c') { scanf("%d/%d %lf", &uc1, &uc2, &h); printf("create: "); if (p[uc1*10+uc2] != -1) { printf("already exists\n"); } else { p[uc1*10+uc2] = 0; printf("ok"); } } else if (pr[0] == 'd') { scanf("%d/%d %lf", &uc1, &uc2, &h); printf("deposit %.2lf: ", h); if (p[uc1*10+uc2] == -1) { printf("no such account\n"); } else { p[uc1*10+uc2] += h; printf("ok\n"); } } else if (pr[0] == 't') { scanf("%d/%d %d/%d %lf", &uc1, &uc2, &ut1, &ut2, &h); printf("transfer %.2lf: ", h); if (p[uc1*10+uc2] == -1) { printf("no such account\n"); } else if (p[ut1*10+ut2] == -1) { printf("no such account\n"); } else if (p[uc1*10+uc2] < h) { printf("insufficient funds\n"); } else { p[ut1*10+ut2] -= h; p[uc1*10+uc2] += h; if (uc2 == ut2) { printf("ok\n"); } else { printf("interbank\n"); } } } scanf("%s",pr); } printf("end\n"); } return 0; }