Problem H. Math Game
Input file: standard input
Output file: standard output
Time limit: 1 seconds
Memory limit: 128 megabytes
We all know that big brother is the horse skin
Ma big brother liked digit numbers and research, and now the hands of big brother Ma there are n numbers, he wanted to know that there are n numbers how many numbers of digits and is a multiple of 7?
Input
A first line of input integer T, representative of the next set of test data with a T for each set of test data, a first input n represents an integer of n digital input next line number n a [i], representing each digit
1 <= T <= 10,1 <= n <= 2*105 ,1 <= a[i] <= 10^9
Output
For each set of test data, it outputs the corresponding answer.
Example
standard input |
standard output |
1 5 16 2 7 14 95 |
3 |
#include <the iostream> #include <CString> #define N 200000 the using namespace STD; int main () { int T, A [N]; Memset (A, 0 , the sizeof (A)); CIN >> T; // the number of samples the while (T-- ) { int n-, SUM = 0 ; CIN >> n-; // single sample number for ( int I = . 1 ; I <= n-; I ++ ) { int X; CIN >>X; int ANS = 0 ; the while (X) // to just read the number of processed immediately { ANS + X% = 10 ; X = X / 10 ; } IF (% ANS . 7 == 0 ) SUM ++ ; } COUT << SUM << endl; } return 0 ; }
Three nested loop