Logo
(追記) (追記ここまで)

26227번 - Amazing Divisibility 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB26191669.565%

문제

The sun was setting. Teddy sat in the bus 127, stuck in traffic. Bored, he'd already figured out how to get a hundred by juggling with the digits of his ticket number. He noticed that if he added the digits of the number of the bus to those of the year of his birth, 1997, he got a number divisible by 7. <<Heh!>>, --- Teddy thought and wrote 12 after the bus number, because that day was the 12th. Again, he got a number divisible by 7. The evening was becoming fun. Finally, he wrote the day of the month after the year of his birth.

"Coincidence? I don't think so!", --- Teddy wondered and dashed out of the bus to get home as fast as he could run, to write a program to evaluate the probability of his results.

Help Teddy write a program that finds the number of ways to choose a pair of numbers from a given set, such that if the digits of the second number are added to those of the first, the resulting number is divisible by 7.

입력

The first line of the input file contains an integer $N$ --- the number of numbers(2ドル\leq N\leq 10^5$).

The second line contains $N$ space-separated different integers$a_i$ (1ドル\leq i\leq N,ドル 1ドル\leq a_i\leq 10^9$).

출력

The output file must contain a single number - the number of ways to choose a pair of numbers from a given set, such that if the digits of the second number are added to those of the first, the resulting number is divisible by 7.

제한

예제 입력 1

3
127 1996 12

예제 출력 1

4

예제 입력 2

4
11 2 1 12

예제 출력 2

4

노트

In the first test a total of 6ドル$ pairs can be made of the three numbers. If the number 1996 is written after 12, the resulting number is 121996ドル = 7 \cdot 17428$. The three remaining pairs are described in the problem body.

출처

Contest > Open Cup > 2016/2017 Season > Stage 2: Grand Prix of Eurasia 6번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /