“Convertir C en Python en ligne” Réponses codées

Convertir C en Python en ligne

#include <stdio.h>
#include <stdlib.h>
/*ADJACENCY MATRIX*/
int source,X,Y,time,visited[20],Z[20][20];
void DFS(int p)
{
int q;
visited[p]=1;
printf(" %d->",p+1);
for(q=0;q<X;q++)
{
if(Z[p][q]==1&&visited[q]==0)
DFS(q);
}
}
int main()
{
int p,q,x1,x2;
printf("\t\t\tGraphs\n");
printf("Enter the required number of edges:");
scanf("%d",&Y);
printf("Enter the required number of vertices:");
scanf("%d",&X);
for(p=0;p<X;p++)
{
for(q=0;q<X;q++)
Z[p][q]=0;
}
/*creating edges : */
for(p=0;p<Y;p++)
{
printf("Enter the format of the edges (format: x1 x2) : ");
scanf("%d%d",&x1,&x2);
Z[x1-1][x2-1]=1;
}
for(p=0;p<X;p++)
{
for(q=0;q<X;q++)
printf(" %d ",Z[p][q]);
printf("\n");
}
printf("Enter the source of the DFS: ");
scanf("%d",&source);
DFS(source-1);
return 0;
}
KBot

Convertir C en Python en ligne

#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main()
{
    clock_t start, end;
    double time_taken;

    int size = 4 * 1024;
    int arr[size];

    start = clock();

    for (int i = 0; i < size; i++)
        arr[i] = i;

    end = clock();

    time_taken = ((double) (end - start)) / CLOCKS_PER_SEC;

    printf("Time taken: %f\n", time_taken);
    return 0;
}
Jash

Convertir C en Python en ligne

#include <iostream>
#include <math.h>
using namespace std;
int main()
{
//(|x|-|y|)/(1+|xy|)
float x,y;
cin >> x >> y;
cout.setf(ios::fixed|ios::showpoint);
cout.precision(1);
cout << (abs(x)-abs(y))/((1+abs(x*y)));
return 0;
}
Clumsy Crossbill

Convertir C en Python en ligne

#include <iostream>
#include <math.h>
using namespace std;
int main()
{
//(|x|-|y|)/(1+|xy|)
float x,y;
cin >> x >> y;
cout.setf(ios::fixed|ios::showpoint);
cout.precision(1);
cout << (abs(x)-abs(y))/((1+abs(x*y)));
return 0;
}
Clumsy Crossbill

Convertir C en Python en ligne

#include <stdio.h>
int main(void) {
const int SIZE = 10;
    int peopleage[10] = {60,18,53,51,42,56,61,34,78,26};
    int gen_z=0,gen_millenial=0,gen_x=0,gen_babyboomer=0,gen_silent=0;
    int i; 
    
if (SIZE>0) for(i=0;i<SIZE;i++)
    if (peopleage[i] <=25) {printf("This person %d is in gen Z.\n",i+1);gen_z++;}
        else if 
            (peopleage[i] >26 && peopleage[i]<=40){ 
            printf("This person %d is in gen millenial.\n",i+1);gen_millenial++;}
            else if
            (peopleage[i] >41 && peopleage[i]<=55){printf("This person %d is in gen X.\n",i+1);gen_x++;}
                else if 
                (peopleage[i] >56 &&peopleage[i]<=75)
                { printf("This person %d is in gen baby boomers.\n",i+1);gen_babyboomer++;}
                else 
                    {printf("This person %d is in gen silent generation.\n",i+1);gen_silent++;}
                    else 
                        printf("Please specify people's ages.");
return 0; }
Long Loris

Convertir C en Python en ligne

int solution (vector<vector<char> > A, int K) {
    int res=0;
   for(int i=0;i<A.size();i++)
   {
       vector<int> pol;
       vector<int> thi;
       for(int j=0;j<A[0].size();j++)
       {
           if (A[i][j] == 'P') 
            pol.push_back(j); 
        else if (A[i][j] == 'T') 
            thi.push_back(j);
       }

       // track lowest current indices of 
    // thief: thi[l], police: pol[r] 

       int l = 0, r = 0; 
    while (l < thi.size() && r < pol.size()) {
        if (abs(thi[l] - pol[r]) <= K) { 
            res++; 
            l++; 
            r++; 
        } 
        // increment the minimum index 
        else if (thi[l] < pol[r]) 
            l++;
        else
            r++; 
    }
    pol.clear();
    thi.clear();
   }
   return res;
}
MOUNIKA MINNY

Convertir C en Python en ligne

import java.util.*;
import java.lang.*;
import java.io.*;

public class Solution {
    
 public static void main(String[] args) {
	

	}
	public static void count(String x){
		char[] ch = x.toCharArray();
		int letter = 0;
		int space = 0;
		int num = 0;
		int miss = 0;
		for(int i = 0; i < x.length(); i++){
			if(Character.isLetter(ch[i])){
				letter ++ ;
			}
			else if(Character.isDigit(ch[i])){
				num ++ ;
			}
			else if(Character.isSpaceChar(ch[i])){
				space ++ ;
			}
			else{
				miss+=1;
			}
		}
		System.out.println(miss);
			}
}
Vadivelu K

Convertir C en Python en ligne

#include <iostream>
#include <math.h>
using namespace std;
int main()
{
//(|x|-|y|)/(1+|xy|)
float x,y;
cin >> x >> y;
cout.setf(ios::fixed|ios::showpoint);
cout.precision(1);
cout << (abs(x)-abs(y))/((1+abs(x*y)));
return 0;
}
Clumsy Crossbill

Convertir C en Python en ligne


void btree::postorder(node* p, int indent)
{
    if(p != NULL) {
        if(p->right) {
            postorder(p->right, indent+4);
        }
        if (indent) {
            std::cout << std::setw(indent) << ' ';
        }
        if (p->right) std::cout<<" /\n" << std::setw(indent) << ' ';
        std::cout<< p->key_value << "\n ";
        if(p->left) {
            std::cout << std::setw(indent) << ' ' <<" \\\n";
            postorder(p->left, indent+4);
        }
    }
}
Blushing Batfish

Convertir C en Python en ligne

#include <stdio.h>

int main()
{
    int initialStars = 5;
    int line = initialStars;
    // scanf("%d", &initialStars);
    for (int i = 1; i <= initialStars; i = i + 1)
    {
        for (int k = 1; k < line; k++)
        {
            printf(" ");
        }
        for (int j = 1; j <= i; j++)
        {
            printf("%d", j);
        }
        printf("\n");
        line--;
    }
    return 0;
}
Prisha Patel

Réponses similaires à “Convertir C en Python en ligne”

Questions similaires à “Convertir C en Python en ligne”

Plus de réponses similaires à “Convertir C en Python en ligne” dans Python

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code