dp in cycle