From 46f58a9473839e5cba661071b35c6c123ba61be3 Mon Sep 17 00:00:00 2001 From: tomarviii88 <43980170+tomarviii88@users.noreply.github.com> Date: Sun, 28 Oct 2018 11:24:17 +0530 Subject: [PATCH] Create Save the prisoner!.cpp Solution of Save the prisoner from implementation section of hackerrank. --- .../implementation/Save the prisoner!.cpp | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 algorithms/implementation/Save the prisoner!.cpp diff --git a/algorithms/implementation/Save the prisoner!.cpp b/algorithms/implementation/Save the prisoner!.cpp new file mode 100644 index 0000000..425c617 --- /dev/null +++ b/algorithms/implementation/Save the prisoner!.cpp @@ -0,0 +1,24 @@ +#include +using namespace std; +int main() +{ + long int n,m,s,a; int t,i; + cin>>t; + for(i=0;i>n>>m>>s; + a=s+m-1; + if(a>n) + { + if(a%n==0) + { + cout<