Efficient algorithms for the Deutsch-Jozsa and Simon's problems that only use classical resources