Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- https://cke.gov.pl/images/_EGZAMIN_MATURALNY_OD_2015/Arkusze_egzaminacyjne/2016/formula_od_2015/MIN-R1_1P-162.pdf
- Liczby skojarzone
- */
- #include <iostream>
- using namespace std;
- int main()
- {
- int t,r,k,j,p=0;
- cin>>k,r;
- for(int a=0;a<2;a++)
- {
- int *l, *w;
- if(a==0) {l=&k; w=&r;}
- if(a==1) {l=&r; w=&k;}
- cout<<"Dzielniki: ";
- t=0;
- for(int i=1;i<(*l/2)+1;i++)
- {
- if(*l%i==0)
- {
- t+=i;
- cout<<i<<" ";
- }
- }
- if(t+1==*w) p++;
- cout<<'\t'<<"Suma: "<<t<<'\n';
- delete l; delete w;
- }
- if (p==2) cout<<"TAK";
- else cout<<"NIE";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement