結果

問題 No.294 SuperFizzBuzz
ユーザー AreTrashAreTrash
提出日時 2016-09-30 07:09:22
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 1,469 ms / 5,000 ms
コード長 923 bytes
コンパイル時間 4,670 ms
コンパイル使用メモリ 102,380 KB
実行使用メモリ 22,836 KB
最終ジャッジ日時 2023-08-13 15:16:42
合計ジャッジ時間 14,754 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 54 ms
20,780 KB
testcase_01 AC 54 ms
22,796 KB
testcase_02 AC 1,469 ms
20,744 KB
testcase_03 AC 54 ms
20,648 KB
testcase_04 AC 55 ms
22,836 KB
testcase_05 AC 54 ms
20,720 KB
testcase_06 AC 55 ms
20,640 KB
testcase_07 AC 55 ms
20,700 KB
testcase_08 AC 125 ms
20,820 KB
testcase_09 AC 825 ms
20,652 KB
testcase_10 AC 826 ms
20,764 KB
testcase_11 AC 1,337 ms
22,796 KB
testcase_12 AC 1,379 ms
20,648 KB
testcase_13 AC 1,413 ms
20,740 KB
testcase_14 AC 1,455 ms
20,588 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace No294{
    public class Program{
        public static void Main(string[] args){
            var N = int.Parse(Console.ReadLine());

            var cnt = 0;
            for(var i = 1; i < 30; i++){
                for(var j = 0; j < 1 << i; j++){
                    var pc = Ex.PopCount(j);
                    if((pc * 5 + (i - pc) * 3) % 3 == 0 && (j & 1) == 1){
                        cnt++;
                    }
                    if(cnt == N){
                        Console.WriteLine(Convert.ToString(j, 2).PadLeft(i, '0').Replace('0', '3').Replace('1', '5'));
                        return;
                    }
                }
            }
        }
    }

    public class Ex{
        public static int PopCount(int x){
            var res = 0;
            while(x != 0){
                res++;
                x &= x - 1;
            }
            return res;
        }
    }
}
0