PAT-B-1001-C#描述

using System;

namespace PAT
{
    class Program
    {
        static void Main(string[] args)
        {
            int num = Convert.ToInt32(Console.ReadLine());
            int deep = 0;
            while (num != 1)
            {
                if (num % 2 == 0)
                {
                    num /= 2;
                    deep++;
                }
                else
                {
                    num = (num * 3 + 1) / 2;
                    deep++;
                }
            }
            Console.WriteLine(step);
        }
    }
}

发布了14 篇原创文章 · 获赞 1 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/m0_37302219/article/details/79463527
今日推荐