Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- I.
- 1.a.
- 2.d.
- 3.a
- 4.b
- 5.c
- II.
- 1.a. 2020
- b. 1234 2345
- c.
- #include <iostream>
- using namespace std;
- int main()
- { int n,m,i,x;
- cin>>n;
- m=0;
- for(int i=1;i<=n;i++)
- {
- cin>>x;
- while(x%10>(x/10)%10) x=x/10;
- m=m+x;
- }
- if(m>0) cout<<m;
- else cout<<"niciunul";
- return 0;
- }
- d.
- citește n (număr natural nenul)
- m=0
- i=1;
- ┌cat timp (i<=n)
- │ citește x (număr natural)
- │┌cât timp x%10 > [x/10]%10 execută
- ││ x=[x/10]
- │└■
- │ m=m+x
- │ i++;
- └■
- ┌dacă m>0 atunci scrie m
- │altfel scrie „niciunul”
- └■
- 2.
- struct figura{ struct {float x,y;}centru;
- float raza;
- }c;
- 3.
- for(i=0;i<7;i++)
- for(j=0;j<=j<7;j++)
- if(i>j)
- a[i][j]="+";
- else
- if(i==0)
- a[i][j]=char("a"+j);
- else
- a[i][j]=a[i-1][j-1];
- III.
- 1.
- int multiplu(int n)
- {int ok=0,i=1,cn;
- while(ok==0)
- {cn=n*i;
- if(sqrt(cn)*sqrt(cn)==cn)
- return cn;
- i++;
- }
- }
- 2.
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {char s[101];
- int i,n,ok=0;
- cin.getline(s,101);
- n=strlen(s)+1;
- for(i=0;i<n;i++)
- {if(s[i]=='<')
- ok=1;
- if(s[i]=='>')
- ok=0;
- if(ok==1 && s[i]>='a' && s[i]<='z')
- s[i]=char(s[i]-('a'-'A'));}
- cout<<s;
- return 0;
- }
- 3.
- #include <bits/stdc++.h>
- using namespace std;
- ifstream fin("bac.in");
- int main()
- {int d,a,aa,c,mini=2e9,cc=0,ok=0;
- fin>>aa>>a;
- while(fin>>c)
- {if(a>aa && a>c)
- {ok=1;
- d=abs(aa-c);
- if(d<mini)
- {cc=a;
- mini=d;}
- else
- if(d==mini)
- cc=max(cc,a);}
- aa=a;
- a=c;
- }
- if(ok==1)
- cout<<cc;
- else
- cout<<"NU EXISTA";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement