Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
381 B
1
Indexable
Never
#include <stdio.h>
#include <math.h>

int main()
{
    long long int a, b, c;
    long long int t;
    scanf("%lld", &t);
    for (int i = 0; i < t; i++)
    {
        scanf("%lld %lld %lld", &a, &b, &c);
        if (b % 3 == 1 && c % 3 == 1)
            printf("-1\n");
        else
            printf("%lld\n", a + ceil((b + c) / 3));
        }

    return 0;
}
Leave a Comment