\documentclass{article}

\usepackage{amsthm}
\usepackage{answers}
\usepackage[colorlinks]{hyperref} 

\title{Exercices with Solutions}
\author{}
\date{}



%%%%%%%%%%%%
% Definition of a new theorem style for the exercises
%
% The last parameter will transform the name of the thm environment
% (e.g. Exercise 1) into a link to the solution
%%%%%%%%%%%%
\newtheoremstyle{exos}{\topsep}{\topsep}{}{}{\bfseries}{.}{.5em}{\hyperref[sol:#2]{\thmname{#1} #2\thmnote{ \small -- \emph{(#3)}}}}

\theoremstyle{exos}
\newtheorem{exercice}{Exercise}

%%%%%%%%%%%%
% Unfortunately I did not succeed to put the label of the exercise
% into the style above. So I created a __new__ environment which
% will use the previously defined env.
%%%%%%%%%%%%
\newenvironment{exo}[1]{%
	\begin{minipage}{\linewidth}
	\begin{exercice}#1\label{exo:\theexercice}%
}
{%
	\end{exercice}
	\end{minipage}%
		\bigskip
}

%%%%%%%%%%%%
% Now I use the answers package
% and provide a counter to list the solutions
% And I renew the solution environment to add the labels and hyperrefs
%%%%%%%%%%%%
\Newassociation{sol}{solution}{ans}

\newcounter{solutions}
\renewenvironment{solution}[1]{\begin{trivlist}\item \hyperref[exo:#1]{\bfseries Solution #1}\textbf{.}\refstepcounter{solutions}\label{sol:#1} }{\end{trivlist}}


\begin{document}

\maketitle

\section{Easy Exercises}

% Anwer package, the solutions will go in easy.tex
\Opensolutionfile{ans}[easy]

\begin{exo}
Text of the easy exercise

\begin{sol}Solution of the easy exercise\end{sol}
\end{exo}

%Closing the solution file
\Closesolutionfile{ans}

\newpage
\section{Hard Exercises}

% Anwer package, the solutions will go in hard.tex
\Opensolutionfile{ans}[hard]

\begin{exo}
Text of the hard exercise

\begin{sol}Solution of the hard exercise\end{sol}
\end{exo}

%Closing the solution file
\Closesolutionfile{ans}

\newpage

\section{Solutions}

% Input of the solution files
\input{easy}
\input{hard}

\end{document}
