Problem H: 零起点学算法109——单数变复数

#include <stdio.h>
#include<string.h>
int main(void)
{
    int n;
    char word[100];
    scanf("%d",&n);
    getchar();
    int i;
    while(n!=0)
    {
        gets(word);
        int k=strlen(word);
        if(word[k-1]==‘y‘)
            strcat(word,"es");
        else if(word[k-2]==‘s‘||word[k-1]==‘x‘)
            strcat(word,"es");
        else if(word[k-2]==‘s‘&&word[k-1]==‘h‘)
            strcat(word,"es");
        else if(word[k-2]==‘c‘&&word[k-1]==‘h‘)
            strcat(word,"es");
        else if(word[k-1]==‘o‘)
            strcat(word,"es");
        else
            strcat(word,"s");
        puts(word);
        n--;
    }
    return 0;
}

似乎用printf提交ac不了,用put可以

原文地址:https://www.cnblogs.com/chenlong991223/p/10090787.html

时间: 2024-08-29 10:36:58

Problem H: 零起点学算法109——单数变复数的相关文章

1168: 零起点学算法75——单数变复数

1168: 零起点学算法75--单数变复数 Time Limit: 1 Sec  Memory Limit: 64 MB   64bit IO Format: %lldSubmitted: 443  Accepted: 345[Submit][Status][Web Board] Description 英文单词,我们可以按照英语语法规则把单数变成复数.规则如下: (1)以辅音字母y结尾,则加es (2)以s,x,ch,sh结尾,则加es (3)以元音o结尾,则加es (4)其他情况加上s In

Problem H: 零起点学算法87——打印所有低于平均分的分数

#include<stdio.h> int main(){ int n,a[200],b[200]; while(scanf("%d",&n)!=EOF){ int s=0; for(int i=0;i<n;i++){ scanf("%d",&a[i]); s+=a[i]; } float ave=(float)s/n; int j=0; for(int i=0;i<n;i++){ if(a[i]<ave){ b[j]=

Problem O: 零起点学算法10——求圆柱体的表面积

#include<stdio.h> int main() { float r,h,pi; pi=3.1415926; scanf("%f %f",&r,&h); printf("Area=""%.3f",2*pi*r*r+2*pi*r*h); return 0; } 原文地址:https://www.cnblogs.com/chenlong991223/p/9720035.html

Problem U: 零起点学算法19——输出特殊值

#include<stdio.h> int main() { printf("%%d"); return 0; } 原文地址:https://www.cnblogs.com/chenlong991223/p/9720422.html

Problem V: 零起点学算法20——输出特殊值II

#include<stdio.h> int main() { printf("\\n"); return 0; } 原文地址:https://www.cnblogs.com/chenlong991223/p/9720428.html

Problem S: 零起点学算法14——三位数反转

#include<stdio.h> #include<stdlib.h> int main() { int a,b,c,s; scanf("%d",&s); a=s/100; b=s%100/10; c=s%100%10; printf("%d%d%d",c,b,a); system("pause"); return 0; } 原文地址:https://www.cnblogs.com/chenlong991223/

Problem T: 零起点学算法15——交换变量

#include<stdio.h> int main() { int a,b,c; scanf("%d %d",&a,&b); c=a; a=b; b=c; printf("%d %d",a,b); return 0; } 原文地址:https://www.cnblogs.com/chenlong991223/p/9720399.html

Problem Z: 零起点学算法22——求正弦和余弦

#include<stdio.h> #include <math.h> int main() { int n; const double pi=acos(-1); double a,b; while(scanf("%d",&n)!=EOF) a=sin(n*pi/180); b=cos(n*pi/180); printf("%.2f\n%.2f\n",a,b); return 0; } 原文地址:https://www.cnblogs

Problem Y: 零起点学算法21——摄氏温度转换

#include<stdio.h> int main() { float f,c; while(scanf("%f",&f)!=EOF) c=5.0/9*(f-32); printf("%.3f",c); return 0; } 原文地址:https://www.cnblogs.com/chenlong991223/p/9742929.html