提出 #46525383


ソースコード 拡げる

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;

namespace Tasks;

public class B
{
    public static void Main()
    {
        using var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }

    public static void Solve()
    {
        var N = Scanner.Scan<long>();
        while (N > 1 && N % 2 == 0) N /= 2;
        while (N > 1 && N % 3 == 0) N /= 3;
        var answer = N == 1;
        Console.WriteLine(answer ? "Yes" : "No");
    }

    public static class Scanner
    {
        public static T Scan<T>() where T : IConvertible => Convert<T>(ScanStringArray()[0]);
        public static (T1, T2) Scan<T1, T2>() where T1 : IConvertible where T2 : IConvertible
        {
            var input = ScanStringArray();
            return (Convert<T1>(input[0]), Convert<T2>(input[1]));
        }
        public static (T1, T2, T3) Scan<T1, T2, T3>() where T1 : IConvertible where T2 : IConvertible where T3 : IConvertible
        {
            var input = ScanStringArray();
            return (Convert<T1>(input[0]), Convert<T2>(input[1]), Convert<T3>(input[2]));
        }
        public static (T1, T2, T3, T4) Scan<T1, T2, T3, T4>() where T1 : IConvertible where T2 : IConvertible where T3 : IConvertible where T4 : IConvertible
        {
            var input = ScanStringArray();
            return (Convert<T1>(input[0]), Convert<T2>(input[1]), Convert<T3>(input[2]), Convert<T4>(input[3]));
        }
        public static (T1, T2, T3, T4, T5) Scan<T1, T2, T3, T4, T5>() where T1 : IConvertible where T2 : IConvertible where T3 : IConvertible where T4 : IConvertible where T5 : IConvertible
        {
            var input = ScanStringArray();
            return (Convert<T1>(input[0]), Convert<T2>(input[1]), Convert<T3>(input[2]), Convert<T4>(input[3]), Convert<T5>(input[4]));
        }
        public static (T1, T2, T3, T4, T5, T6) Scan<T1, T2, T3, T4, T5, T6>() where T1 : IConvertible where T2 : IConvertible where T3 : IConvertible where T4 : IConvertible where T5 : IConvertible where T6 : IConvertible
        {
            var input = ScanStringArray();
            return (Convert<T1>(input[0]), Convert<T2>(input[1]), Convert<T3>(input[2]), Convert<T4>(input[3]), Convert<T5>(input[4]), Convert<T6>(input[5]));
        }
        public static IEnumerable<T> ScanEnumerable<T>() where T : IConvertible => ScanStringArray().Select(Convert<T>);
        private static string[] ScanStringArray()
        {
            var line = Console.ReadLine()?.Trim() ?? string.Empty;
            return string.IsNullOrEmpty(line) ? Array.Empty<string>() : line.Split(' ');
        }
        private static T Convert<T>(string value) where T : IConvertible => (T)System.Convert.ChangeType(value, typeof(T));
    }
}

提出情報

提出日時
問題 B - 3-smooth Numbers
ユーザ AconCavy
言語 C# 11.0 (.NET 7.0.7)
得点 200
コード長 2974 Byte
結果 AC
実行時間 50 ms
メモリ 25028 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 4
AC × 23
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt, 02_random_20.txt, 02_random_21.txt, 02_random_22.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 42 ms 24656 KiB
00_sample_01.txt AC 50 ms 24748 KiB
00_sample_02.txt AC 49 ms 24736 KiB
00_sample_03.txt AC 41 ms 24768 KiB
01_handmade_04.txt AC 43 ms 24512 KiB
01_handmade_05.txt AC 38 ms 24744 KiB
01_handmade_06.txt AC 42 ms 24712 KiB
02_random_07.txt AC 41 ms 24744 KiB
02_random_08.txt AC 40 ms 24884 KiB
02_random_09.txt AC 32 ms 24512 KiB
02_random_10.txt AC 37 ms 24724 KiB
02_random_11.txt AC 34 ms 24796 KiB
02_random_12.txt AC 38 ms 25028 KiB
02_random_13.txt AC 41 ms 24544 KiB
02_random_14.txt AC 40 ms 24736 KiB
02_random_15.txt AC 42 ms 24568 KiB
02_random_16.txt AC 43 ms 24588 KiB
02_random_17.txt AC 37 ms 24876 KiB
02_random_18.txt AC 41 ms 24572 KiB
02_random_19.txt AC 41 ms 24856 KiB
02_random_20.txt AC 42 ms 24872 KiB
02_random_21.txt AC 38 ms 24640 KiB
02_random_22.txt AC 46 ms 24656 KiB