【Project Euler】4 第四题

简介:


//A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.
//Find the largest palindrome made from the product of two 3-digit numbers.
      

  static void Main(string[] args)
        {
            int sum = 0;
            for (int i = 10; i < 1000; i++)
            {
                for (int j = 10; j < 1000; j++)
                {
                    sum = i * j;
                    if (sum / 100000 < 10)
                    {
                        int a = sum / 100000;
                        int b = (sum - a * 100000) / 10000;
                        int c = (sum - a * 100000 - b * 10000) / 1000;
                        int d = (sum - a * 100000 - b * 10000 - c * 1000) / 100;
                        int e = (sum - a * 100000 - b * 10000 - c * 1000 - d * 100) / 10;
                        int f = sum - a * 100000 - b * 10000 - c * 1000 - d * 100 - e * 10;
                        if (a == f && b == e && c == d)
                        {
                            if (sum > 900000)
                            {
                                Console.WriteLine(sum);
                            }
                        }
                    }
                }
            }
        }

目录
相关文章
|
5天前
|
Java 测试技术 Maven
Default (Build) 生命周期
Maven的Default(Build)生命周期包括23个阶段,从validate到deploy,涉及源码编译、资源处理、测试、打包和部署等步骤。命令如`mvn compile`只会执行及之前的所有阶段。不同目标与生命周期阶段绑定,适应JAR、WAR、EAR等不同类型项目的构建需求。
|
5天前
|
Java 调度 数据库管理
APScheduler自定义配置
APScheduler自定义配置
18 0
|
5天前
|
Kubernetes 容器
Warning FailedScheduling 14m (x12 over 16m) default-scheduler 0/1 nodes are available: 1 node(s
Warning FailedScheduling 14m (x12 over 16m) default-scheduler 0/1 nodes are available: 1 node(s
40 0
|
5天前
|
Apache 调度 数据库
Apache DolphinScheduler VS WhaleScheduler
Apache DolphinScheduler VS WhaleScheduler
186 2
|
5天前
|
资源调度
在SchedulerX中,你可以使用`schedulerx.output()`函数来向Worker报告运行结果
【1月更文挑战第7天】【1月更文挑战第35篇】在SchedulerX中,你可以使用`schedulerx.output()`函数来向Worker报告运行结果
21 1
|
资源调度 调度
SchedulerX - Hello world
介绍 SchedulerX 是阿里中间件团队开发的一款分布式任务调度产品,在阿里内部有着广泛的使用,经过集团内上千个业务应用历经多年打磨而成。
3887 0
|
人工智能 算法框架/工具