Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///_____SUBIECTUL III 1_____
- int suma(int a, int b)
- {
- int s=1, i;
- if(b>a)
- swap(a, b);
- for(i=2; i<=a; i++)
- if(a%i==0 && b%i==0)
- s+=i;
- return s;
- }
- ///_____SUBIECTUL III 2_____
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main()
- {
- int i;
- char s[101], *p, ch, aux[101], sn[101]="";
- cin.getline(s, 101);
- p=strtok(s, " ");
- while(p)
- {
- strcpy(aux, p);
- if(strlen(aux)>=3)
- {
- ch=aux[0];
- for(i=0; i<strlen(aux)-1; i++)
- aux[i]=aux[i+1];
- aux[strlen(aux)-1]=ch;
- }
- strcat(sn, aux);
- strcat(sn, " ");
- p=strtok(NULL, " ");
- }
- strcpy(s, sn);
- cout<<s;
- return 0;
- }
- ///_____SUBIECTUL III 3_____
- #include <iostream>
- #include <fstream>
- using namespace std;
- ifstream fin("bac.in");
- int main()
- {
- int x, f[11]={}, i;
- bool ok1=0, ok2=0;
- while(fin>>x)
- f[x]++;
- for(i=1; i<=11; i++)
- {
- if(ok1==1 && f[i]%2==1)
- {
- cout<<"NU";
- ok2=1;
- break;
- }
- if(f[i]%2)
- ok1=1;
- }
- if(ok2==0)
- cout<<"DA";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment