Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Teza 8
- I.
- 1.b.
- 2.c.
- 3.a
- 4.b
- 5.c.
- *f(6)
- *cout<<6 *f(1) *f(2) *f(3)
- *cout<<1 - *cout<<2 *f(1) *cout<<3 *f(1)
- *cout<<1 - *cout<<1 -
- II.
- 1.a.16
- b.6
- c.
- #include<iostream>
- using namespace std;
- int main()
- {int x,y,i;
- cin>>x;
- y=0;
- for(i=1;i<=x/2;i++)
- if(x%i==0)
- y=y+i;
- if(y==x)
- cout<<1<<' '<<x;
- else
- cout<<y;
- }
- d.
- citeste x
- (x numar natural, x!=1)
- y=0
- i=0
- ┌cat timp i<=x/2 executa
- │ ┌daca x%i=0 atunci
- │ │ y=y+i
- │ └■
- │ i=i+1
- └■
- ┌ daca y=x atunci
- │ scrie 1,' ',x
- │ altfel
- │ scrie y
- └■
- 2.if((t.a == t.b && t.a != t.c)||(t.a == t.c && t.a != t.b) ||(t.b == t.c && t.b != t.a))
- 3.
- n=0;
- for(i=1;i<=5;i++)
- {cin>>s;
- if(s[1]==2 && s[2]==0 && s[3]==1 && s[4]==9)
- n++;
- }
- III.
- 1.
- #include <iostream>
- using namespace std;
- int main()
- {int a[11][11],i,j,n,nr;
- cin>>n;
- for(i=1;i<=n;i++)
- for(j=1;j<=n;j++)
- cin>>a[i][j];
- for(i=1;i<=n;i++)
- {nr=0;
- for(j=1;j<=n;j++)
- nr=nr*2+a[i][j];
- cout<<nr<<" ";}
- return 0;
- }
- 2.
- #include <iostream>
- #include <cmath>
- using namespace std;
- int patrat(int n)
- {int i,p,maxi=0;
- for(i=1;i*i<=n;i++)
- if(n%i==0)
- {if (sqrt(i)*sqrt(i)==i && i>maxi)
- maxi=i;
- if(i*i<n)
- if(sqrt(n/i)*sqrt(n/i)==n/i && n/i>maxi)
- maxi=n/i;}
- return maxi;
- }
- int main()
- {int n;
- cin>>n;
- cout<<patrat(n);
- return 0;
- }
- 3.
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream fin("BAC.TXT");
- int main()
- {int x,s5=0,maxi=2e-9,cx,ap;
- while(fin>>x)
- {cx=x;
- s5=0;
- while(cx)
- {s5=s5+cx/5;
- cx/=5;}
- if(s5>maxi)
- {ap=1;
- maxi=s5;}
- else
- if(s5==maxi)
- ap++;
- }
- cout<<ap<<" "<<maxi;
- return 0;
- }
Add Comment
Please, Sign In to add comment