From d685dd4f2c324b8a6a45e2aba7dba35b1b9175e2 Mon Sep 17 00:00:00 2001 From: Ritwik Singh <46321538+ritwiksingh21@users.noreply.github.com> Date: Thu, 8 Oct 2020 08:51:00 +0530 Subject: [PATCH] Adding Solution file --- Stone/Solution_Stones_C | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 Stone/Solution_Stones_C diff --git a/Stone/Solution_Stones_C b/Stone/Solution_Stones_C new file mode 100644 index 0000000..8b74e52 --- /dev/null +++ b/Stone/Solution_Stones_C @@ -0,0 +1,19 @@ +#include + +int main() +{ + int a,b,c,ans,t; + scanf("%d", &t); + while(t--){ + ans=0; + scanf("%d %d %d", &a, &b, &c); + while(b>=1 && c>=2){ + b-=1; c-=2; ans+=3; + } + while(a>=1 && b>=2){ + a-=1; b-=2; ans+=3; + } + printf("%d\n", ans); + } + return 0; +}