DIV11 - Chia cho 11

View as PDF

Submit solution

Points: 100.00
Time limit: 1.0s
Memory limit: 1000M
Input: stdin
Output: stdout

Author:
Problem type
Allowed languages
C, C++, GAS64, Pascal, Perl, PHP, Python, Sed, TCL, Text

Cho dãy số nguyên gồm N phần tử A1,A2,...,AN trong đó Ai là các chữ số (0Ai<10). Đếm số lượng cặp (i,j) thỏa mãn:

  • 1i<jN;</li>
  • Ai0Aj(AiAj) chia hết cho 11.
Dữ liệu
  • Dòng đầu gồm một số nguyên dương N (1N105).
  • Dòng thứ hai gồm N chữ số A1,A2,...,AN (0Ai<10).
Kết quả
  • Gồm một số nguyên duy nhất là kết quả bài toán.
Ví dụ
Sample Input 1
Copy
2
5 6
Sample Output 1
Copy
1
Giải thích
  • Gồm cặp (1,2) thỏa mãn vì: 506(56) chia hết cho 11

Nguồn: Free Contest


Comments

Please read the guidelines before commenting.


There are no comments at the moment.