Cities scramble to trim budgets as state cuts loom