Manchester


私信TA

用户名:wenyajie

访问量:313886

签 名:

在历史前进的逻辑中前进,这个逻辑就是人心向背的逻辑

等  级
排  名 1
经  验 62896
参赛次数 1
文章发表 188
年  龄 0
在职情况 学生
学  校 Xiamen University
专  业 计算机科学

  自我简介:

在历史前进的逻辑中前进,这个逻辑就是人心向背的逻辑

解题思路:
把要判断的数的每一位存入数组,首尾相同,且中间两个数也相同,输出结果;

参考代码:

#include <stdio.h>
#include <math.h>
int main()
{
    int    A[5];
    int    B = 95860, B1, i;

    while ( 1 )
    {
        B++;
        B1 = B;

        i = 0;
        while ( i != 5 )
        {
            A[i]    = B1 % 10;
            B1    /= 10;
            ++i;
        }

        if ( A[0] == A[4] && A[1] == A[3] )
        {
            printf( "%d", B );
            break;
        }
    }
    return(0);
}


 

0.0分

12 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区

#include<stdio.h>
int main()
{
	for(int i=95860;;i++)
	{
		if((i/1000)/10==(i%100)%10&&(i/1000)%10==(i%100)/10)
		{
			printf("%d",i);
			return 0;
		}
	}
}
2021-12-03 09:17:32
#include <stdio.h>
#include <string.h>
#include <math.h>
int main()
{
   int n,s,i,v,a,b,c,d;
   for(i=95860;n!=1;i++)
   {
   	   a=i/10000;
   	   b=i/1000%10;
   	   c=i%100/10;
   	   d=i%10;
   	   if(a*10+b==d*10+c)
   	   {
   	   	n=1;
		  }
   }
   i-=1;
   v=(i-95859)/2;
   printf("%d %d",v,i);
}
2021-08-21 18:46:25
nb
2021-01-06 20:01:46
nb
2020-03-23 11:03:56
  • «
  • 1
  • »