Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //сумма не делится на div и разница между элементами меньше чем diff
- // Я В ДУШЕ НЕ ЕБУ РАБОТАЕТ ЛИ ЭТО
- #include <iostream>
- using namespace std;
- int main(){
- const int div = 8, diff = 7; // константа
- int temp, N, a[diff]={0}, count=0;
- cin >> N;
- for(int j=0; j<diff; j++){
- cin >> a[j];
- }
- for(int j=0; j<diff; j++){
- for(int k=j+1; k<diff; k++){
- temp = a[j] + a[k];
- if(temp % div != 0){
- count++;
- cout << a[j] << " + " << a[k] << " = " << temp << endl;
- }
- }
- }
- for(int i=diff; i<N; i++){
- cin >> temp;
- for(int j=0; j<diff; j++) if(temp%div + a[j] != div) {count++;
- cout << temp << " + " << a[j] << " = " << temp + a[j] << endl;
- }
- for(int j=0; j<diff-1; j++) a[j]=a[j+1];
- a[diff-1] = temp;
- }
- cout << count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement