Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int INF(int *t, int poczatek, int koniec){
- int suma = 0, p1, p2;
- for(int i = poczatek; i<koniec; i++)
- for(int k =poczatek; k<koniec; k++)
- suma = suma + t[i] + t[k];
- p1 = poczatek + (koniec - poczatek +1)/3;
- p2 = poczatek + 2*(koniec - poczatek +1)/3;
- return suma+2*INF(t,poczatek,p1)+6*INF(t,p1,p2)+INF(t,p2,koniec);
- }
- int main(){
- int tab[10] = {1,2,3,4};
- INF(tab, 1,3);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement