Codeforces 71A

#include<stdio.h>
int main()
{
char s[1000];
int i,l,t,n;scanf("%d",&t);
for(n=1;n<=t;n++)
{
    scanf("%s",s);
    l=strlen(s);
if(l<=10)
printf("%s\n",s);
if(l>10)
{

        printf("%c%d%c\n",s[0],l-2,s[l-1]);

}
}
return 0;
}
Advertisements

Codeforces 4A

#include<stdio.h>
int main()
{
    int s,w;
scanf("%d",&w);
if(w<=2)
printf("NO\n");
    else
    {
        s=(w%2==0)?1:0;
        if(s==1)
        printf("YES\n");
    else
    printf("NO\n");
    
    }
    
}

Codeforces solution

My solved problems with solutions are

codeforces: 1A

#include<stdio.h>
int main ()
{
    int n;
    int m;
    int a;

    scanf ("%d %d %d", &n, &m, &a);

    printf ("%0.lf\n", ceil(n / (double) a) * ceil (m / (double) a));

    return 0;
}

UVa Problems

TRY First,

Here is someΒ of my solved problrms

Codeforces : 41A

Problem Id: 41A

#Source Code


 

#include <stdio.h>
#include<string.h>
int main()
{
char n[20],m[20],c=0,temp;
scanf(“%s”,n);int i,j,l2;
int l=strlen(n);
scanf(“%s”,m);l2=strlen(m);
for(i=0,j=(l-1);i<l/2;i++,j–)
{
temp=n[i];
n[i]=n[j];
n[j]=temp;

}
if(l==l2){
for(i=0;i<l;i++)
{
if(m[i]==n[i])
c++;
}
if(c==l)
printf(“YES\n”);
else
printf(“NO\n”);c=0;
}
else
printf(“NO\n”);c=0;
}