I have to check, if given number is divisible by 7, which is usualy done just by doing something like n % 7 == 0
, but the problem is, that given number can have up to 100000000, which doesn't fit even in long long
.
Another constrain is, that I have only few kilobytes of memory available, so I can't use an array.
I'm expecting the number to be on stdin and output to be 1
/0
.
This is an example
34123461273648125348912534981264376128345812354821354127346821354982135418235489162345891724592183459321864592158
0
It should be possible to do using only about 7 integer variables and cin.get()
. It should be also done using only standard libraries.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…