Ecological premium is a very easy problem. Just you have to look at datatype. Consider following test case -
Input:-
10
99999 99999 99999
99999 99999 99999
99999 99999 99999
99999 99999 99999
99999 99999 99999
99999 99999 99999
99999 99999 99999
99999 99999 99999
99999 99999 99999
99999 99999 99999
Output:-
99998000010
And following table is showing all fundamental integer types of variables in C:
Keyword | Size | Range | Format Specifier |
---|---|---|---|
int | 2 | -32768 --> +32767 | %d |
long | 4 | -2,147,483,648 --> 2,147,438,647 | %ld |
long long | 8 | −9223372036854775807 --> +9223372036854775807 | %lld |
unsigned int | 2 | 0 --> 65535 | %u |
unsigned long | 4 | 0 --> 4,294,967,295 | %lu |
unsigned long long | 8 | 0 --> 18446744073709551614 | %llu |
So carefully choice datatype.
Happy coding.
Happy coding.
No comments:
Post a Comment