Vous êtes sur la page 1sur 7

//======================1164=======================//

#include <stdio.h>

int main( void )


{
int n;

scanf( "%d", &n );

int i, num[n], soma[n], j;

for( i = 0; i < n; i++ )


{
soma[i] = 0;
scanf( "%d", &num[i] );

for( j = 1; j <= num[i] / 2; j++ )


if( num[i] % j == 0 )
soma[i] += j;

for( i = 0; i < n; i++ )


if( num[i] == soma[i] )
printf( "%d eh perfeito\n", num[i] );
else
printf( "%d nao eh perfeito\n", num[i] );

return 0;
}
//=====================1009==========================//
#include <stdio.h>

int main (void)


{
char NOME[30];
double SALARIO, VENDAS, TOTAL;

scanf("%s%lf%lf", NOME, &SALARIO, &VENDAS );

TOTAL = VENDAS * .15 + SALARIO;

printf( "TOTAL = R$ %.2lf\n", TOTAL );

return 0;

}
//======================1168==========================//
#include <stdio.h>
int main( void )
{
// n = quantidade de casos de teste; i e j = contador.
int n, i, leds = 0, j;
// como o numero v tem que ser <= 10^100... (v tem 102 caracteres por que tem
o caractere de fim de string \0 e outro que esqueci
char v[102];
scanf( "%d", &n );

// pegar o caractere do [enter] para no entrar na string.


getchar();
for( i = 0; i < n; i++ )
{
fgets( v, sizeof( v ), stdin );
// enquanto o fim da string no chegar
while( v[j] != '\0' )
{
// verificar cada caractere da string e adicionar a quantidade respecti
va de leds na variavel leds.
if( v[j] == '1' )
leds += 2;
else
if( v[j] == '2' || v[j] == '3' || v[j] == '5' )
leds += 5;
else
if( v[j] == '4' )
leds += 4;
else
if( v[j] == '6' || v[j] == '9' || v[j] == '0' )
leds += 6;
else
if( v[j] == '7' )
leds += 3;
else
if( v[j] == '8' )
leds += 7;
j++;
}
//imprimir a quantidade de leds para esta string.
printf( "%d leds\n", leds );
// zerar leds e j para a prxima iterao.
leds = 0;
j = 0;
}
return 0;
}
//============================1555====================//
#include <stdio.h>
int main( void )
{
int n;
scanf( "%d", &n );
int r[n], b[n], c[n], x[n], y[n], i, win[n];

for( i = 0; i < n; i++ )


{
scanf( "%d%d", &x[i], &y[i] );
r[i] = ( 3 * x[i] ) * ( 3 * x[i] ) + y[i] * y[i];
b[i] = 2 * ( x[i] * x[i] ) + ( 5 * y[i] ) * ( 5 * y[i] );
c[i] = -1 * 100 * x[i] + y[i] * y[i] * y[i];
if( r[i] >=
win[i] =
else
if( b[i] >=
win[i] =
else
if( c[i] >=
win[i] =

b[i] && r[i] >= c[i] )


1;
r[i] && b[i] >= c[i] )
2;
r[i] && c[i] >= b[i] )
3;

}
for( i = 0; i < n; i++ )
switch( win[i] )
{
case 1:
puts( "Rafael ganhou" );
break;
case 2:
puts( "Beto ganhou" );
break;
case 3:
puts( "Carlos ganhou" );
break;
default:
break;
}
return 0;
}
//============================1578=========================//
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
int main()
{
unsigned long long m[25][25], num;
int n, i, x, w, j, dig[25][25], digm[25],a=0;
scanf("%d", &n);
for(w=0; w<n; w++)
{
scanf("%d", &x);
for(i=0; i<x; i++)
{
for( j=0; j<x; j++)
{
scanf("%llu", &m[i][j]);

m[i][j] *= m[i][j];
num = m[i][j];
dig[i][j] = 0;
if(num==0){num=1;}
while(num>0)
{
num /= 10;
dig[i][j]++;
}
if(i==0) digm[j] = dig[i][j];
else if(dig[i][j]>digm[j]) digm[j] = dig[i][j];
}
}
printf("Quadrado da matriz #%d:\n", (w+4));
for(i=0; i<x; i++)
{
for(j=0;j<x;j++)
{
while(dig[i][j]<digm[j])
{
printf(" ");
dig[i][j]++;
}
printf("%llu", m[i][j]);
if(j==(x-1)) printf("\n");
else printf(" ");
}
}
if(w<(n-1))
printf("\n");
}
return 0;
}
//====================================1035================//
#include <stdio.h>
int main (void)
{
int A, B, C, D;
scanf( "%d%d%d%d", &A, &B, &C, &D );
if( A % 2 == 0 && C >= 0 && D >= 0 && B > C && D > A && C + D > A + B )
puts( "Valores aceitos" );
else
puts( "Valores nao aceitos" );
return 0;
}
//===========================1548===========================//
#include <stdio.h>
int main() {
int n, p[1000] , m, aux, troca=0, parado ,t[1000];
int j, i, k, c; //contadores
scanf("%d\n", &n);
for ( j=0; j < n; j++)
{

scanf("%d", &m);
for (i = 0; i < m; i++)
{
scanf("%d", &p[i]);
}
for (i = 0; i < m; i++)
{
t[i] = p[i];
}
for(c = 0;c < m-1 ;c++ ) //ordem decrescente
{
for(k = c+1 ;k < m ; k++)
{
if(p[c] < p[k])
{
aux=p[c];
p[c]=p[k];
p[k]=aux;
}
}
}
for (i = 0; i < m; i++)
{
if(t[i] == p[i])
{
troca++;
}
}
printf("%d\n", troca);
troca =0;
}
return 0;
}
//==========================1024==============================//
#include <stdio.h>
int main() {
int n;
int i, j=0, k, l, m; // contadores
char T[1000], Aux[1000];
scanf("%d\n",&n);
for (i=0; i < n; i++ )
{
gets(T);
j = 0;
while ( T[j] != '\0')
{
if( T[j] > 64 && T[j] < 91 || T[j] > 96 && T[j] < 123 )
{
T[j] = T[j] + 3;
}
j++;
}
k = j;
j = 0;
l = k-1;
for(j = 0; j < k; j++)
{
Aux[l] = T[j];
l--;

}
m = k/2;
for(l = m; l < k; l++)
{
Aux[l] = Aux[l] - 1;
}
Aux[k] = '\0';
puts(Aux);
}
return 0;
}
//=============================1028=======================//
#include <stdio.h>
int main ( void )
{
int n, f1, f2, i, aux, resto;
scanf( "%d", &n );
for ( i = 0; i < n; i++ )
{
scanf( "%d%d", &f1, &f2 );
if( f2 > f1 )
{
aux = f2;
f2 = f1;
f1 = aux;
}
resto = f1 % f2;
while( resto != 0 )
{
f1 = f2;
f2 = resto;
resto = f1%f2;
}
printf( "%d\n", f2 );
}
return 0;
}
//=============================1632====================//
#include <stdio.h>
int main() {
int t,i,j; // contadores
int p;
char s[1000];
scanf("%d\n", &t);
for (i =0; i < t ; i++)
{
gets(s);
j=0;
p=1;

while (s[j] != '\0')


{
if (s[j] == 'a' || s[j] == 'e' || s[j] == 'i' ||
== 's' || s[j] == 'A' || s[j] == 'E' || s[j] == 'I' || s[j]
S')
{
p = p * 3;
}
else
{
p = p * 2;
}
j++;
}
printf("%d\n", p);
}
return 0;
}
//=====================1124==============================//
#include<stdio.h>
int main(void){
int l=1,c=1,r1=1,r2=1;
while (l != 0 && c != 0 && r1 != 0 && r2 != 0)
{
scanf("%d %d %d %d", &l, &c, &r1, &r2);
if (l == 0 && c == 0 && r1 == 0 && r2 == 0)
{
return 0;
}
if (r1 * 2 <= l && r1 * 2 <= c && r2 * 2 <= l && r2
{
if ( sqrt(pow((r1 - ( c - r2)), 2) + pow(((l - r1) )
{
printf("S\n");
}
else
{
printf("N\n");
}
}
else
{
printf("N\n");
}
}
return 0;
}

s[j] == 'o' || s[j]


== 'O' || s[j] == '

* 2 <= c )
r2), 2)) >= r1 + r2