0% found this document useful (0 votes)
12 views9 pages

Dat 241130

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views9 pages

Dat 241130

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

1.

#include <iostream>

#include <cmath>

using namespace std;

void CL (int n)

int c=0;

int l=0;

while (n>=1)

int k=n%10;

if (k%2==0) c++;

else l++;

n=n/10;

cout<<c<<" "<<l;

int main()

int T;

cin>>T;

for ( int i=1; i<=T; i++)

int n;

cin>>n;

if (n>pow(10,20)) cin>>n;

CL(n);
cout<<endl;

return 0;

2.

#include <iostream>

#include <cmath>

using namespace std;

string CL (int n)

int c=0;

int l=0;

while (n>=1)

int k=n%10;

if (k%2==0) c++;

else l++;

n=n/10;

if (c==0 || l==0) return "yes";

else return "no";

int main()

int T;

cin>>T;
for ( int i=1; i<=T; i++)

int n;

cin>>n;

if (n>pow(10,20)) cin>>n;

cout<<CL(n);

cout<<endl;

return 0;

3.

#include <iostream>

using namespace std;

void UCL(int n)

int p=0;

for ( int i=n-1;i>0;i--)

if (n%i==0 && i%2==1)

if (p==0)

cout<<i;

p++;

else break;

}
}

cout<<endl;

int main()

int T;

cin>>T;

for ( int i=1; i<=T; i++)

int n;

cin>>n;

if(n>=100) cin>>n;

UCL(n);

return 0;

4.

#include <iostream>

#include <cmath>

using namespace std;

int CSNT(int n)

int p=0;

while (n>=1)

int k=n%10;
if(k==2 || k==3 || k==5 || k==7) p++;

n=n/10;

return p;

int main()

int T;

cin>>T;

for (int i=1; i<=T; i++)

int n;

cin>>n;

if(n>=pow(10,20)) cin>>n;

cout<<CSNT(n)<<endl;

return 0;

5. #include <iostream>

#include <stdbool.h>

using namespace std;

bool circle (string moves)

int x=0;

int y=0;

int k=moves.length();
bool T=1;

for (int i=0; i<k;i++)

if(moves[i]=='R') x++;

else if(moves[i]=='L') x--;

else if (moves[i]=='U') y++;

else if (moves[i]=='D') y--;

if (x==0 && y==0) return T;

else

T=0;

return T;

int m()

string moves;

cin>>moves;

cout<<circle(moves);

return 0;

6.

bool isCollinear( int x1, int y1, int x2, int y2, int x3, int y3)

bool T=1;

double y=y2-y1;
double x=x2-x1;

double y01=y3-y1;

double x01=x3-x1;

if(x==x01||y==y01 || (x/x01==y/y01) || (x01/x==y01/y))return T;

else

T=0;

return T;

7.

8.

#include <iostream>

#include <stdbool.h>

using namespace std;

bool isIsomorphic (string a, string b)

bool T=1;

int k=a.length();

int p=b.length();

if(k!=p)

T=0;

return T;

else

for (int i=1; i<=k;i++)


{

for ( int j=2; j<=k; j++)

if(a[i]!=a[j] && b[i]==b[j])

T=0;

if (a[i]==a[j] && b[i]!= b[j])

T=0;

return T;

int m()

string a,b;

cin>>a>>b;

cout<<isIsomorphic(a, b);

return 0;

9.

#include <iostream>

using namespace std;


int getTriangleType(int a, int b, int c)

if (a+b<=c || b+c<=a || a+c<=b) return 0;

else if (a==b && b==c) return 2;

else if ((a==b && b!=c)||(a==c && b!=c) ||(c==b && b!=a)) return 1;

else return 3;

10.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy