結果
問題 |
No.294 SuperFizzBuzz
|
ユーザー |
![]() |
提出日時 | 2016-09-30 07:13:47 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 698 ms / 5,000 ms |
コード長 | 924 bytes |
コンパイル時間 | 2,956 ms |
コンパイル使用メモリ | 108,716 KB |
実行使用メモリ | 25,948 KB |
最終ジャッジ日時 | 2024-11-21 11:03:50 |
合計ジャッジ時間 | 8,318 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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 < 114514810; i++){ for(var j = 0; j < 1 << i; j++){ var pc = Ex.PopCount(j) + 1; if((pc * 5 + (i - pc) * 3) % 3 == 0){ cnt++; } if(cnt == N){ Console.WriteLine((Convert.ToString(j, 2).PadLeft(i, '0') + 5).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; } } }