number game 2

0

0 votes
Easy
Problem

we all use modular operator to check weather a number is divisible by 3 or not but for numbers with no. of digits more than 20 modular division wont help even in python it gives us TLE(time limit exceed).
so write a program to check the divisibility of 3 without using modular division.

if the number is divisible by 3 then print "yes" otherwise print the remainder when divided by 3.

INPUT:

 1st line has a number t (no of test cases)
 next t lines will hve the number N

OUTPUT:

 print the required output in new line.

CONSTRAINTS:

1<=t<=1000
1<=N<=10^10000
 

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?