星河依旧璀璨


私信TA

用户名:H2030819021

访问量:714

签 名:

等  级
排  名 657
经  验 3883
参赛次数 16
文章发表 1
年  龄 0
在职情况 学生
学  校 贺州学院
专  业

  自我简介:

TA的其他文章

求车速稍微取巧
浏览:395

解题思路:

假设车速不超过150,两个小时300公里以内(也可以改400 500),将每个数都求出来,然后if判定,如果第一位和第五位相等并且第二位与第四位相等

注意事项:
数字要是回文数
参考代码:

#include<stdio.h>

int main()

{
    int x1,x2,x3,x4,x5;
    int i;
    int num;
    for(i=95859;i<95859+300;i++)
    {
        x1=i/10000;
        x2=(i/1000)%10;
        x3=(i/100)%10;
        x4=(i/10)%10;
        x5=i%10;
        if( x1==x5 && x2==x4)
        {
            printf("%d\n",i);
        }
    }
    return 0;
}


 

0.0分

1 人评分

  评论区

https://www.dotcpp.com/oj/status.php?user_id=H2030819021&cid=3745
https://www.dotcpp.com/oj/status.php?user_id=H2030819021&cid=3593
https://www.dotcpp.com/oj/status.php?user_id=H2030819021&cid=3604
https://www.dotcpp.com/oj/status.php?user_id=H2030819021&cid=3787
https://www.dotcpp.com/oj/status.php?user_id=H2030819021&cid=3942
https://www.dotcpp.com/oj/status.php?user_id=H2030819021&cid=3975
2022-01-08 17:49:12
  • «
  • 1
  • »