Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///_____SUBIECTUL III 1_____
- int divPrim(int n, int &s)
- {
- int d=2, p;
- s=0;
- while(n!=1)
- {
- //cout<<"#";
- p=0;
- while(n%d==0)
- {
- p++;
- n=n/d;
- }
- if(p%2==1)
- s+=d;
- d++;
- }
- return s;
- }
- ///_____SUBIECTUL III 2_____
- #include <iostream>
- #include <cstring>
- using namespace std;
- char a[21][11];
- int main()
- {
- int n, k, i, cnt=0;
- char s[11];
- cin>>n>>k;
- for(i=1; i<=n; i++)
- {
- cin>>s;
- if(strchr("aeiou", s[strlen(s)-1])!=0)
- strcpy(a[++cnt], s);
- }
- if(cnt>=k)
- for(i=1; i<=k; i++)
- cout<<a[i]<<endl;
- else
- cout<<"nu exista";
- return 0;
- }
- ///_____SUBIECTUL III 3_____
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream fin("bac.txt");
- int main()
- {
- int sufix, ant, x, a=-1, b=-1;
- fin>>sufix;
- fin>>ant;
- while(true)
- {
- fin>>x;
- if(x%1000==sufix)
- {
- a=x;
- break;
- }
- }
- ant=a;
- while(fin>>x)
- {
- if(x%1000==sufix && ant%1000==sufix)
- {
- a=ant;
- b=x;
- }
- ant=x;
- }
- if(a==-1 || b==-1)
- cout<<"nu exista";
- else
- cout<<a<<" "<<b;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment