Submission #5916255


Source Code Expand

using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using System.Text.RegularExpressions;
using static MyIO;


public class B
{
	public static void Main()
	{
		int n = GetInt();
		int X = GetInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++)
			a[i] = GetInt();

		int ans = 0;
		for(int i = 0; i < n; i++)
			if(((X >> i) & 1) == 1)
				ans += a[i];
		Console.WriteLine(ans);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}

Submission Info

Submission Time
Task B - 価格の合計
User DM7PvTyc
Language C# (Mono 4.6.2.0)
Score 100
Code Size 1039 Byte
Status AC
Exec Time 21 ms
Memory 11092 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 3
AC × 20
Set Name Test Cases
Sample subtask0_sample01.txt, subtask0_sample02.txt, subtask0_sample03.txt
All subtask0_sample01.txt, subtask0_sample02.txt, subtask0_sample03.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt
Case Name Status Exec Time Memory
subtask0_sample01.txt AC 21 ms 11092 KB
subtask0_sample02.txt AC 21 ms 11092 KB
subtask0_sample03.txt AC 20 ms 9044 KB
subtask1_01.txt AC 20 ms 9044 KB
subtask1_02.txt AC 20 ms 9044 KB
subtask1_03.txt AC 20 ms 9044 KB
subtask1_04.txt AC 20 ms 9044 KB
subtask1_05.txt AC 20 ms 9044 KB
subtask1_06.txt AC 20 ms 9044 KB
subtask1_07.txt AC 20 ms 9044 KB
subtask1_08.txt AC 20 ms 9044 KB
subtask1_09.txt AC 20 ms 9044 KB
subtask1_10.txt AC 21 ms 11092 KB
subtask1_11.txt AC 20 ms 9044 KB
subtask1_12.txt AC 20 ms 9044 KB
subtask1_13.txt AC 21 ms 11092 KB
subtask1_14.txt AC 20 ms 9044 KB
subtask1_15.txt AC 20 ms 11092 KB
subtask1_16.txt AC 21 ms 11092 KB
subtask1_17.txt AC 21 ms 11092 KB