結果
問題 | No.381 名声値を稼ごう Extra |
ユーザー |
![]() |
提出日時 | 2021-04-03 01:32:28 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 678 bytes |
コンパイル時間 | 2,291 ms |
コンパイル使用メモリ | 114,476 KB |
実行使用メモリ | 81,836 KB |
最終ジャッジ日時 | 2024-12-24 00:59:25 |
合計ジャッジ時間 | 11,871 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 1 TLE * 1 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;using System.Linq;using System.Numerics;public static class P{public static void Main(){string ns = Console.ReadLine();BigInteger res = 0;BigInteger dig = 1;foreach (var c in ns.Reverse()){if ((c - '0') % 2 != 0) res += dig;var cdig = dig;dig += cdig << 3;dig += cdig << 1;}Console.WriteLine(res.ToByteArray().Sum(x => PopCount(x)));}static int PopCount(int n) //byte{n = n - ((n >> 1) & 0b01010101);n = (n & 0b00110011) + ((n >> 2) & 0b00110011);return ((n * 0b00010001) >> 4) & 15;}}