Energy in a spring:
E = 0.5 * k * x²
k spring constant = 800 n/m
x stretch of the spring = 5 cm = 0.05 m
E = 0.5 * 800 * 0.05² = 1
Rearranging formulas is all about simple algebra rules. Just like when solving for x in an equation, you're just isolating whichever variable you want. I'll work this one out for you and hopefully it'll help, but if you need more explanation, then feel free to comment!
D = ViT + 0.5at² Subtract ViT from both sides
D - ViT = 0.5at² Divide both sides by 0.5t²
I wrote this step out a little more to show how your fraction will cancel
= a I like to flip these around so the single variable is on the right
a = 
The mineral with Mohs hardness would be scratched because the mineral with Mohs 7 hardness is stronger than the Mohs 5 mineral. Eventually, that mineral would turn into dust if you kept rubbing it.