• hdu 2029 Palindromes _easy version


    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2029

    题目大意:回文数,即第一个和最后一个相同,第二个和倒数第二个相同、、、、以此类推 注意字符的输入,以及计算字符长度的位置。还有要注意清流哦~

     1 #include <stdio.h>
     2 #include <string.h>
     3 int main (void)
     4 {
     5     int m,n,i,l;
     6     char a[100];
     7     while (scanf("%d",&n)!=EOF)
     8     {
     9         getchar();
    10         while (n--)
    11         {
    12             m=1;
    13             gets(a);
    14             l=strlen(a);
    15             for (i=0; i<l/2; i++)
    16             {
    17                 if (a[i]!=a[l-i-1])
    18                  {   m=0;
    19                 break;}
    20             }
    21             if(m)
    22             printf ("yes
    ");
    23             else printf ("no
    ");
    24         }
    25         return 0;
    26     }
    27 }
  • 相关阅读:
    sql性能调优的注意项
    mybatis获取刚插入数据的ID
    mysql
    JQuery
    JS
    css
    web前端
    python爬虫
    socket编程
    python基础
  • 原文地址:https://www.cnblogs.com/qq-star/p/3853777.html
Copyright © 2020-2023  润新知