[Mảng 1 Chiều Cơ Bản]. Bài 46. Cặp số chia hết cho 28
View as PDF
Submit solution
Points:
1.00 (partial)
Time limit:
1.0s
Java
4.0s
Memory limit:
256M
Input:
stdin
Output:
stdout
Author:
Problem source:
Problem type
Allowed languages
C, C#, C++, Java, Kotlin, Pascal, PyPy, Python, Scratch
28Tech là người rất thích số 28, anh ta cho bạn mảng A[] gồm N phần tử, bạn hãy đếm xem trong mảng có bao nhiêu cặp số A[i], A[j] với i khác j mà khi cộng với nhau sẽ tạo thành 1 số chia hết cho 28.
Đầu vào
Dòng 1 là N : số phần tử trong mảng
Dòng 2 là N phần tử cách nhau 1 khoảng trắng
Giới hạn
1<=N<=10^6
0<=A[i]<=10^9
Đầu ra
In ra số cặp thỏa mãn
Ví dụ :
Input 01
5
1 14 14 27 27
Output 01
3
Comments
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.
vận dụng: A % 28 = 0 <=> (a%28 + b%28) % 28 = 0 => đặt x = a%28, y=b%28 <=> (x+y)%28 = 0 mà x, y <= 28 -> x+y=28 -> bài toán trở thành tìm, đếm cặp số dư bằng 28. (TH đặc biệt: x=y=14 , x=y=0 -> xét riêng)
A giúp e với a. E bị wrong answer
include <bits/stdc++.h>
using namespace std;
define ll long long
const int MOD = 1e9 + 7;
ll a[1000006]; ll dem[28];
int main() { iosbase::syncwith_stdio(0); cin.tie(NULL);
}
biến res bị tràn, để ll đi =D
ê bro dù không liên quan lắm nhưng ông cùng ngày tháng năm sinh với tôi thì phải "29/5"
This comment is hidden due to too much negative feedback. Show it anyway.
This comment is hidden due to too much negative feedback. Show it anyway.