Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions Choco Sticks and there distribution/ solution_in_c.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include<stdio.h>
#include<math.h>
int main() {
int yatin,sahil,store;
int cases;
scanf("%d",&cases);
int i,j;
for(i=0;i<cases;i++)
{
yatin=0;sahil=0;store=0;
int n;
scanf("%d",&n);
int box[n];
for(j=0;j<n;j++)
{
scanf("%d",&box[j]);
if(box[j]%7==0) yatin+=box[j];
else if(box[j]%5==0) sahil+=box[j];
else store+=box[j];
}
// if store has value greater than their difference and after adding store to thier difference if we get an even value surely we can distribute it among two of them..

if(((yatin-sahil)+store)%2==0&&(abs(yatin-sahil)<=store)) printf("true\n");
else printf("false\n");

}
}