Created
December 21, 2020 22:15
-
-
Save repcaq/cbc9d0abfe05a811da5e5cc095e0e48c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int ZnajdzMozliweTrojkaty(int tablica[],int n) | |
{ | |
int wynik = 0; | |
for (int i = 0 ; i < n; i++){ | |
for (int j = i++; j<n; j++){ | |
for(int k = j++; k<n; k++){ | |
if((tablica[i] + tablica[j]> tablica[k])&&(tablica[i] + tablica[k]> tablica[j])&&(tablica[k] + tablica[j]> tablica[i])) | |
wynik++; | |
} | |
} | |
} | |
return wynik; | |
} | |
int main() | |
{ | |
int x,y; | |
cin>>x>>y; | |
int tablica[10000]; | |
for(int t=x;t<=y-x;t++) | |
tablica[t]++; | |
int s = sizeof(tablica[10001]) / sizeof(tablica[0]); | |
cout<<ZnajdzMozliweTrojkaty(tablica, s); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment