#include #include float banka[10000][10]; int main() { int uctu; for(;;) { scanf("%d", &uctu); if (!uctu) { printf("goodbye\n"); return 0; } for(int i = 0; i < 10000; i++) { for (int j = 0; j < 10; j++) { banka[i][j] = -1.0; } } int tmp1, tmp2; for (int i = 0; i < uctu; i++) { scanf("%d/%d", &tmp1, &tmp2); scanf("%f", &banka[tmp1][tmp2]); } char str[30]; for(;;) { scanf("%s", str); if (!strcmp(str, "end")) { printf("end\n\n"); break; } if (!strcmp(str, "create")) { int tmp1, tmp2; scanf("%d/%d", &tmp1, &tmp2); if (banka[tmp1][tmp2] == -1.0) { banka[tmp1][tmp2] = 0.0; printf("create: ok\n"); } else { printf("create: already exists\n"); } } if (!strcmp(str, "deposit")) { int tmp1, tmp2; float tmp3; scanf("%d/%d%f", &tmp1, &tmp2, &tmp3); if (banka[tmp1][tmp2] == -1.0) { printf("deposit %.2f: no such account\n", tmp3); } else { banka[tmp1][tmp2] += tmp3; printf("deposit %.2f: ok\n", tmp3); } } if (!strcmp(str, "withdraw")) { int tmp1, tmp2; float tmp3; scanf("%d/%d%f", &tmp1, &tmp2, &tmp3); if (banka[tmp1][tmp2] == -1) { printf("withdraw %.2f: no such account\n", tmp3); } else { if (banka[tmp1][tmp2] >= tmp3) { banka[tmp1][tmp2] -= tmp3; printf("withdraw %.2f: ok\n", tmp3); } else { printf("withdraw %.2f: insufficient funds\n", tmp3); } } } if (!strcmp(str, "transfer")) { int tmp1, tmp2, tmp4, tmp5; float tmp3; scanf("%d/%d%d/%d%f", &tmp1, &tmp2, &tmp4, &tmp5, &tmp3); if (banka[tmp1][tmp2] == -1 || banka[tmp4][tmp5] == -1) { printf("transfer %.2f: no such account\n", tmp3); } else { if (tmp1 == tmp4 && tmp2 == tmp5) { printf("transfer %.2f: same account\n", tmp3); } else if (banka[tmp1][tmp2] >= tmp3) { banka[tmp1][tmp2] -= tmp3; banka[tmp4][tmp5] += tmp3; if (tmp2 == tmp5) printf("transfer %.2f: ok\n", tmp3); else printf("transfer %.2f: interbank\n", tmp3); } else printf("transfer %.2f: insufficient funds\n", tmp3); } } } } }